I've been working with libevent2 and OCaml for the past couple of weeks to
build node.ocaml. It is far from done, but it is interesting enough to
share.

node.ocaml as of now contains a web server and a terminal server that
provides asynchronous programming to OCaml to enable some of my research.
The first example server is a key value pair server that brings OCaml's
Hashtbl to http and terminal IO:

example code:
http://github.com/mathgladiator/node.ocaml/blob/master/test/kvp.ml

This is the first test program, and it works fairly well in a single
threaded environment. I was inspired by node.js to build an evented io
system, and so I begged the question "how does 'OCaml's FFI' compare with
v8's in node.js". In my virtual machine environment (ubuntu 10.04), I got
the following results doing 10,000 requests 50 at a time:

node.js with the "Hello World" script:
2100 requests/second

node.ocaml with kvp.ml:
5300 requests/second

This seems to me to be a very positive first benchmark considering I haven't
optimized anything yet nor have I hacked caml_copy_string yet.

The code is licensed under BSD and available
http://github.com/mathgladiator/node.ocaml .

Any thoughts/questions are appreciated; thank you for your time.

-J
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to