Hey,

So i had my first Hackathon at work last week and my project was to
prototype making a node.js clone using PHP instead of V8. So i
snatched up libuv and joyent's HTTP parser and set off on a 24 hour
coding spree to get something workable. By the time the sun was coming
out the next morning the following code was working.

    <?php

    $http = new node_http();

    $http->listen(8080, function($request, $response) {
        $response->end("yay, super awesome response");
    });

    nodephp_run();

    ?>

The C code that powers it was whipped together really fast and is kind
of hackish as a result. The code has some memory leaks that i haven't
had time to fully track down yet. Some small portions of the code were
borrowed from the phode project.

In a naive benchmark on this simple server VS an equally simple server
in node.js this implementation already out performs node.js in
throughput by being able to serve just under 200% the amount of
requests per second that node.js could. Take that with a grain of salt
though because node.js has much more feature and is much more hardend
from production use. I do believe the PHP binary will have some major
performance gains over V8 as crossing the PHP <--> C barrier seems to
be a much lighter operation then crossing the V8 <--> C++ barrier.

Any help or feedback will be greatly appreciated. The projects source
code can be found here: https://github.com/JosephMoniz/node.php

- Joseph Moniz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to