The attached patch implements an optimisation for the methods generated by named routes. The generated methods will avoid the costly call to url_for if all of these conditions hold:
- Positional arguments are used (i.e. foos_url(1) not foos_url(:id=>1))
- Every argument is passed to the helper method
- there are no :requirements specified for that named route
If all those conditions hold, the helper will simply do string interpolation, which results in a significant speed increase. A loop of 50 000 generations for a standard resourceful named route shows around a 10x speed improvement.
Before 7.920000 0.050000 7.970000 ( 8.098796)
After 0.590000 0.000000 0.590000 ( 0.615036)
Testers are requested, especially in apps with large numbers of named routes.