Re: Node.PHP
| From: | Michael Save | Date: | Thu, 22 Mar 2012 07:13:48 +0000 |
| Subject: | Re: Node.PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317174@lists.php.net to get a copy of this message | ||
Very nice!
I'll have a proper look at this in the morning, and I'll try it out
for myself. Looking forward to seeing more development on this.
Michael
On Thu, Mar 22, 2012 at 11:40 AM, Joseph Moniz <joseph.moniz@gmail.com> wrote:
> 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
>