diff options
author | Jeremy Evans <code@jeremyevans.net> | 2012-09-13 14:13:19 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2012-09-13 14:13:19 -0700 |
commit | 3aef5ce9b35a4659379201eb6bb1dba355a83ba4 (patch) | |
tree | a06c1b68b5db86c99d04cd3df9b57aa8450a6554 /activerecord/lib | |
parent | 0247443debe3670b016495aa32602e82186bfce4 (diff) | |
download | rails-3aef5ce9b35a4659379201eb6bb1dba355a83ba4.tar.gz rails-3aef5ce9b35a4659379201eb6bb1dba355a83ba4.tar.bz2 rails-3aef5ce9b35a4659379201eb6bb1dba355a83ba4.zip |
Freeze columns before using them as hash keys
This reduces the number of allocated strings from columns * (rows + 1) to just columns.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/result.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/result.rb b/activerecord/lib/active_record/result.rb index 2414a4bbd7..5011a0d75d 100644 --- a/activerecord/lib/active_record/result.rb +++ b/activerecord/lib/active_record/result.rb @@ -11,7 +11,7 @@ module ActiveRecord attr_reader :columns, :rows, :column_types def initialize(columns, rows, column_types = {}) - @columns = columns + @columns = columns.map{|c| c.freeze} @rows = rows @hash_rows = nil @column_types = column_types |