Routing optimization - reinstate 8x speedup and fix reloading bug

Lighthouse ticket:
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/981

Fixes a bug that resulted in the routing code only being generated once.
In addition, reverts a change from trunk that turned routing back into a
linear search (from the optimized version). Includes a test and timing
results.

The performance boost is excellent, but the bug fix was very needed; it
was giving very odd routing problems with Hobo's dynamic routes in
development mode.