In a new post to his site Rob Allen talks about how you can speed up the routing in your Slim framework based application using the route cache file.
When you have a lot of routes, that have parameters, consider using the router's cache file to speed up performance.
To do this, you set the routerCacheFile setting to a valid file name. The next time the app is run, then the file is created which contains an associative array with data that means that the router doesn't need to recompile the regular expressions that it uses.
He gives an example of how to enable the setting and makes the recommendation that it's only used in production. He includes a simple example that defines "25 groups, each with 4000 routes, each of which has a placeholder parameter with a constraint." The first run on a route responds in 2.7 seconds but, once the cache file is created, it drops down to just 263 milliseconds - a major improvement.