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
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 :)
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 :
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.
I've won 10 coupons for free domain names recently ... so I've put up a new website in my spare time :)
IPv6-test.com 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.