News for hackers. Stuff that matters.
Re:Pux – High Performance Router for PHP by pedro93 on Sunday January 12, 2014 @11:03PM (#7048844)
First of all, for your information, the benchmark code and details are already there: https://github.com/c9s/router-benchmark sorry I forgot to put the link. :p

We firstly tested the pure dispatching benchmark by a simple benchmark tool. (without ab), code is here.

https://github.com/c9s/router-benchmark/blob/master/code/dis...

Tests including klein, ham, aura, symfony/routing. This tests pure dispatching speed, so the benchmark does not includes cache.

The dispatching benchmark result is here:

https://github.com/c9s/router-benchmark/blob/master/code/dis...

The benchmark with apache is just to show the comparison result (which shares the same configurations).

Pux is basically written in C extension, which reduces the overhead to load classes from PHP files. Also it does a different strategy on route dispatching. to compare the routes as fast as possible, pux uses indexed array to store the route pattern, pcre flag. (In PHP internals, zend_hash_index_find is faster than zend_hash_find)

it's not just iterating all routes in a big loop like Symfony.

Re:Pux – High Performance Router for PHP by Gigablah on Monday January 13, 2014 @02:51AM (#7049418)
> it's not just iterating all routes in a big loop like Symfony.

Well, that happens if you turn off the cache. Otherwise, Symfony actually compiles the routes into something resembling a prefix tree.