diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-05 10:59:50 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-05 11:05:16 -0700 |
commit | 8fee923888192a658d8823b31e77ed0683dfd665 (patch) | |
tree | 27b28c9971a98e770e1a14c4be46174754f0f6d7 /activerecord/lib/active_record/querying.rb | |
parent | 00ae750b23f0f9f59fd7058fc3bff043d2a04c5f (diff) | |
download | rails-8fee923888192a658d8823b31e77ed0683dfd665.tar.gz rails-8fee923888192a658d8823b31e77ed0683dfd665.tar.bz2 rails-8fee923888192a658d8823b31e77ed0683dfd665.zip |
Improve performance of AR object instantiation
We introduced a performance hit by adding an additional iteration
through a model's attributes on creation. We don't actually need the
values from `Result` to be a hash, we can separate the columns and
values and zip them up ourself during the iteration that we have to do.
Diffstat (limited to 'activerecord/lib/active_record/querying.rb')
-rw-r--r-- | activerecord/lib/active_record/querying.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb index e8de4db3a7..9d4df81b07 100644 --- a/activerecord/lib/active_record/querying.rb +++ b/activerecord/lib/active_record/querying.rb @@ -47,7 +47,7 @@ module ActiveRecord } message_bus.instrument('instantiation.active_record', payload) do - result_set.map { |record| instantiate(record, column_types) } + instantiate_result_set(result_set, column_types) end end |