Avoid excessive AST traversal for Routing
Reported by Lourens Naude | July 10th, 2008 @ 03:10 PM | in 2.x
Comments and changes to this ticket
-

Mike Burns July 10th, 2008 @ 03:55 PM
How much of a speedup does this gain?
I just ran some self.z= vs. @z= micro-benchmarks and had to run a large number of these before I saw an obvious difference.
ruby 1.8.6 (2007-09-24 patchlevel 111) [amd64-freebsd7]
-
Lourens Naude July 10th, 2008 @ 04:13 PM
Mike,
I'll attach benchmarks in a bit.
We've got 5 namespaces, each with 10 to 15 odd controllers.
Each map.resources spawns 14 routes ( excluding custom via :collection or :member ) by default.
class Bar
attr_accessor :foo
def method_a
self.foo #method lookup
end
def method_b
foo #method lookup
end
def method_c
@foo #no method lookup
end
end
Routing, especially with a large routes.rb file, features prominently in profiler output as well as bleakhouse dumps.
Bottom line being you'd notice no difference with a limited number of routes.
-
Pratik July 11th, 2008 @ 05:57 PM
- → State changed from new to invalid
-1 on this. If you insists, please do disuss in rails core mailing list.
Thanks.
-
evan July 11th, 2008 @ 05:58 PM
BleakHouse has nothing to do with runtime performance.
I'm them having trouble imagining that is change makes a difference on real apps, and it makes the code harder to understand and introspect.
-
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
