English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-08-22 (03:27)
From: Jeffrey Barber <jeff@m...>
Subject: node.ocaml
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

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:

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.