This project is archived and is in readonly mode.
Callbacks static analysis optimizations
Reported by josh | December 28th, 2008 @ 09:03 PM | in 3.0.2
ActiveSupport::Callbacks are used though out Rails so any micro-optimizations "may" go a long way.
At the moment, the callback's object is checked every time the callback is run, see Callback#evaluate_method. But we do know the type of this object when the callback object is created.
The idea is to have Callback#initialize generate a the "Callback#call" method (omg metaprogramming) that runs the conditionals :if/:unless then fires the callback.
Comments and changes to this ticket
-
Yehuda Katz (wycats) January 27th, 2009 @ 05:21 PM
- Milestone cleared.
-
Scott Taylor February 1st, 2009 @ 04:56 AM
- Tag set to optimisation, patch
Here's a patch which does some static analysis and other cleanup to the callbacks. The code is also more OO-ish, and cleaner, IMHO.
I've attached a series of 9 patches as tarball (generated with git-format-patch) - some include benchmarks, some include misc. cleanup. I've left it as a tarball so that you can pick and choose what you like.
Let me know if you'd prefer one big unified diff.
-
Yehuda Katz (wycats) February 2nd, 2009 @ 04:00 PM
I actually did a ton of work related to this ticket, completely rewriting the callback system and making it between 10-20x faster. I also added around filters, skipping, and a per-key optimization for ActionPack callbacks. You can see the work I'm doing at http://github.com/wycats/rails/t... and some posts detailing the work I'm doing at http://yehudakatz.com/.
> -
Pratik April 21st, 2009 @ 03:28 PM
- State changed from new to stale
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Medium
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>