Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cheaper attribute reads and respond_to?. Add underscore-prefixed meth…
…od aliased to the attribute name so it can be overridden but still called internally.
- Loading branch information
1 parent
004fc1c
commit 86acbf1
Showing
3 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This created a lot of confusion today, as we used underscore-prefixed methods in our model code ourselves. Also, i think changes like this should not be part of a minor version bump or a security release.
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit causes our Rails app to run very slowly and to use about twice the amount of RAM. We tested the following code snippet with Rails at this and the previous commit. With this commit it ran around 15 times slower than with the previous commit.
We're running Ruby 1.8, so we thought we'd try the same benchmark with Ruby 1.9. With 1.9 there were no problems at all.
In order to fix the performance regression right here and now, we have downgraded to Rails 3.0.5.
My best guess as to why this is happening is that Object#send is much more expensive on 1.8 than 1.9.
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was reverted though before 3.0.6. @tenderlove, c/d?
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean it isn't a part of the final 3.0.6 release?
As far as I can see, it is: https://github.com/rails/rails/blob/v3.0.6/activerecord/lib/active_record/attribute_methods/read.rb
It is even mentioned in the release notes: http://weblog.rubyonrails.org/2011/4/6/rails-3-0-6-has-been-released
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RasmusRn, you are right. So we were planning to revert it but we didn't. Maybe @jeremy or @tenderlove have something to add, let's wait.
86acbf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit fixes a bug. The problem is outlined in the comments on 0823bbd
We need to find a way other than reverting this commit to fix the slowness. ❤️