nanoserv 2.1.1 is out !

November 30th, 2011


The main changes in this version are :

  • Added asynchronous HTTP server class (see handlers/HTTP/Server)
  • Speed optimizations in core and HTTP, 10-12% more reqs/s with ab -k -c200
  • Fixed stream write buffers and Socket::Write_From_Stream()
  • Fixed delayed handling of outgoing connections timeouts
  • Fixed descriptor leak when __destruct() was delayed after peer disconnect
  • Fixed Makefile so "make install" works correctly on OS X

plus small bug fixes and performance optimizations


October 24th, 2010


The term comes from Perl Golf where the point is to solve programming challenges with as few bytes as possible. Just like in real golf where players aspire to get the ball in the hole with as few strokes as possible.
This thing is soooo adictive and frustrating, just try it :)

strlen vs. isset

September 26th, 2010

I've been working on new performance optimizations in nanoserv 2.1.1-dev in the last few days, and I found this one interesting enough to write about it ...

Nanoserv uses buffering for all socket write operations, and until now it was using strlen() in various places to compare it with some pointer to the current buffer position. However, strlen() can be quite slow, and in some cases it can be replaced with a simple test using isset().

The two code snippets below are equivalent, because in the end all we want to know is if our pointer is inside or outside the string :


if ($nb !== strlen($data)) $this->blocked true;


if (isset($data[$nb])) $this->blocked true;

When testing strlen() vs. isset($str[$x]) using a micro benchmark, I obtained the following results :

strlen : 0.233 s
isset : 0.067 s

So isset() is about 3.5x faster here. In nanoserv 2.1.1 with all calls to strlen() changed into isset()s there is a noticeable gain of about 2-3% with the apache benchmark.

April 11th, 2010


I've won 10 coupons for free domain names recently ... so I've put up a new website in my spare time :) checks your IPv6 and IPv4 connectivity and allow you to see which addresse(s) you are currently using to browse the Internet, and what is your browser's protocol of choice when both are available.

It makes use of cross-domain XMLHttpRequest to check for IPv6 and IPv4 connectivity on the same page (feel free to browse the javascript source code).

PHP 5.3.2 is out

March 12th, 2010


PHP 5.3.2 is now out !

This releases includes my fix for bug #50787, which could manifest itself with nanoserv and shared objects, and basically prevented any IPC operation that had a result larger than 8192 bytes once serialize()d.