This patch adds optimization on routes recognition. Current implementation scans through the all patterns, what consumes a lot of time. I've added first-level prefix testing. It helps skip a number of routes with a same static prefix if incoming path doesn't contain such prefix.
Depending on your routes schema, it may give up to 2.7x speedup.
What's in the patch:
1) 1500 lines of routing.rb are split into routing/*.rb files
2) Modified recognition time test to use more realistic routes scheme (based on restful routes)
3) Added some inline changes and a new file routing_recognition_optimisation.rb
Patch was applied to rev. 5931f016d9b10479c0c4f509459d92f75b86a7ab at git://git.koziarski.com/rails.git
PS. In a separate toy library i got 8.8x performance boost. But to apply it to actionpack, we need great refactoring. See my experiment here:
http://gitorious.org/projects/uri-fast-routing/repos/mainline