Hacker News new | past | comments | ask | show | jobs | submit login

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.




> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: