This project is archived and is in readonly mode.
Fix for routing optimization code
Reported by Matt Jones | September 6th, 2008 @ 12:08 PM | in 2.1.2
Related info: http://dev.rubyonrails.org/ticke... - original patch http://hobo.lighthouseapp.com/pr... - observed failure
The routing optimization code introduced by #10835 above has a serious bug - it only generates the recognize_optimized method once. This causes errors when routes are reloaded - if any are different, then the generated indexing code is not correct.
The changes in commit a5db1488251304ec93256654859b430148f0c506 caused the code to be generated at initialization, when no routes were loaded. While this prevents the above bug, it converts the efficient search intended by #10835 back into a linear search of all routes.
The attached patch re-enables efficient search while clearing the generated code when the routes are reloaded. A test for correct code generation is included - it fails on the 2.1.0 version.
--Matt Jones
Comments and changes to this ticket
-
Matt Jones September 6th, 2008 @ 12:10 PM
- Tag set to actionpack, bug, patch, routing, tested
Forgot to include the timing info:
Before change: Generation (RouteSet): (40000 urls) 0.0556527018547058 ms/url 17968.5795419372 url/s
Recognition (215 routes): 0.258163173993429 ms/url 3873.5191566302 url/s
After change: Generation (RouteSet): (40000 urls) 0.0557102739810944 ms/url 17950.0104476125 url/s
Recognition (215 routes): 0.0320691665013631 ms/url 31182.6002698728 url/s
(from routing_test.rb timing test)
-
Pratik September 6th, 2008 @ 01:05 PM
- Assigned user set to Michael Koziarski
-
Michael Koziarski September 6th, 2008 @ 04:43 PM
- Assigned user changed from Michael Koziarski to josh
This looks ok to me, I don't have reliable internet for a few days.
Josh, can you take care of this?
-
Michael Koziarski September 6th, 2008 @ 04:57 PM
- Milestone changed from 2.x to 2.1.2
-
Michael Koziarski September 6th, 2008 @ 05:00 PM
Matt, could you upload a 2-1-stable friendly version of this patch
-
Matt Jones September 6th, 2008 @ 09:07 PM
As requested - patch against 2-1-stable.
Performance for this case is identical before/after, the slowdown was in trunk.
-
Repository September 7th, 2008 @ 04:30 PM
- State changed from new to resolved
(from [7e6cda15f8dae517f9605f73aa1c966a29d4930a]) Ensure routing optimizations are cleared when new routes are added [#981 state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
Repository September 7th, 2008 @ 04:33 PM
(from [d4ef5908edfd471dfd3635a7264b5f8aafe246b6]) Ensure routing optimizations are cleared when new routes are added [#981 state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 981 Fix for routing optimization code (from [7e6cda15f8dae517f9605f73aa1c966a29d4930a]) Ensure ...
- 981 Fix for routing optimization code (from [d4ef5908edfd471dfd3635a7264b5f8aafe246b6]) Ensure ...