aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-09-24 14:03:27 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-09-24 14:06:59 -0600
commit136fc65c9b8b66e1fb56f3a17f0d1fddff9b4bd0 (patch)
tree88df6c3943bc23df8d5acf748cb8c02f9221f376 /activemodel/lib/active_model/validations.rb
parent8a811c83aa386e4ad26553c913d1a450d8a98d5f (diff)
downloadrails-136fc65c9b8b66e1fb56f3a17f0d1fddff9b4bd0.tar.gz
rails-136fc65c9b8b66e1fb56f3a17f0d1fddff9b4bd0.tar.bz2
rails-136fc65c9b8b66e1fb56f3a17f0d1fddff9b4bd0.zip
Improve the performance of `save` and friends
The biggest source of the performance regression in these methods occurred because dirty tracking required eagerly materializing and type casting the assigned values. In the previous commits, I've changed dirty tracking to perform the comparisons lazily. However, all of this is moot when calling `save`, since `changes_applied` will be called, which just ends up eagerly materializing everything, anyway. With the new mutation tracker, it's easy to just compare the previous two hashes in the same lazy fashion. We will not have aliasing issues with this setup, which is proven by the fact that we're able to detect nested mutation. Before: User.create! 2.007k (± 7.1%) i/s - 10.098k After: User.create! 2.557k (± 3.5%) i/s - 12.789k Fixes #19859
Diffstat (limited to 'activemodel/lib/active_model/validations.rb')
0 files changed, 0 insertions, 0 deletions