On my home page, routing is the top user of CPU according to Webgrind. I have a little bit of code that detects special requests then passes general requests to Phalcon routing.
There is one generic route:
$router->add('/(.*)', ['controller' => 'index', 'action' => 'index']);
then several groups of routes similar to the following.
$router->add('/users/(.*)', ['controller' => 'users', 'action' => 'redirect']);
$router->add('/users/user/(.*)', ['controller' => 'users', 'action' => 'user']);
$router->add('/users/user/', ['controller' => 'users', 'action' => 'redirect']);
$router->add('/users/user', ['controller' => 'users', 'action' => 'redirect']);
The home page is the one where I need to impress with speed. Other pages tend to be lists with big database components; the routing microseconds will not be significant.
The home page total time is 21 microseconds and php::Phalcon\Mvc\Router->handle uses 6.36. There are a couple of other items where I can shave off 1 microsecond. Chomping 6 down to something small will be the biggest saving. All suggestions welcome.