aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorViktar Basharymau <viktar.basharymau@thehamon.com>2014-05-22 21:16:56 +0300
committerViktar Basharymau <viktar.basharymau@thehamon.com>2014-05-22 21:16:56 +0300
commitee92c61689dd2cd0700d136385a3d2616c993e10 (patch)
tree5c84e26a806d9190848ee52c2dc634ba39cd8375 /activerecord/lib/active_record
parent66dd216705c9401cfa559a52910df80bd9c7808b (diff)
downloadrails-ee92c61689dd2cd0700d136385a3d2616c993e10.tar.gz
rails-ee92c61689dd2cd0700d136385a3d2616c993e10.tar.bz2
rails-ee92c61689dd2cd0700d136385a3d2616c993e10.zip
Remove unnecessary `Hash#to_a` call
Inspired by https://github.com/rails/rails/commit/931ee4186b877856b212b0085cd7bd7f6a4aea67 ```ruby def stat(num) start = GC.stat(:total_allocated_object) num.times { yield } total_obj_count = GC.stat(:total_allocated_object) - start puts "#{total_obj_count / num} allocations per call" end h = { 'x' => 'y' } stat(100) { h. each { |pair| pair } } stat(100) { h.to_a.each { |pair| pair } } __END__ 1 allocations per call 2 allocations per call ```
Diffstat (limited to 'activerecord/lib/active_record')
0 files changed, 0 insertions, 0 deletions