aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/examples
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-12 09:00:03 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-12 17:23:23 -0600
commitd82dafe65c1137a2f84975c202d471054533f7bc (patch)
treead493c4ce897d58a97b79276221d42d7837e1e18 /activerecord/examples
parent46139d33c06715e74ad450428ece3ee84da98579 (diff)
downloadrails-d82dafe65c1137a2f84975c202d471054533f7bc.tar.gz
rails-d82dafe65c1137a2f84975c202d471054533f7bc.tar.bz2
rails-d82dafe65c1137a2f84975c202d471054533f7bc.zip
Fix performance regression on preloading HABTM associations
We'd spend a lot of time calling `hash` and `eql?` on the join model, which has no primary key. Calling `id` with no primary key is a really slow way to get back `nil`, so we can improve the performance there. However, even with the escape clause, we *still* weren't getting high enough performance, as we were checking the primary key too much. `hash` will always return `nil.hash` for records with no id, and `==` will always return `false`. We can optimize those cases in the HABTM join model.
Diffstat (limited to 'activerecord/examples')
0 files changed, 0 insertions, 0 deletions