2014/10/18分のコミットです。
CHANGELOGへの追加はありませんでした。
Add necessary 'require reverse_merge' to HAWI.rb
activesupport/lib/active_support/hash_with_indifferent_access.rb
の修正です。
require 'active_support/core_ext/hash/reverse_merge'
を追加しています。
HashWithIndifferentAccess
の中でreverse_merge
メソッドを使用しているのに、requireが無かったので、追加しています。
Replace (slower) block.call with (faster) yield
block.call
よりyield
の方がメソッド呼び出した早いとい事で、一通り修正しています。
require 'benchmark/ips' def fast yield end def slow(&block) block.call end Benchmark.ips do |x| x.report('fast') { fast{} } x.report('slow') { slow{} } end # => fast 154095 i/100ms # => slow 71454 i/100ms # => # => fast 7511067.8 (±5.0%) i/s - 37445085 in 4.999660s # => slow 1227576.9 (±6.8%) i/s - 6145044 in 5.028356s
これもまた大分差がでますねえ。
Ruby Conference 2014でErik MichaelsがRubyの高速化についてのプレゼンを行っており、それを参考にしたようです。動画はこちら。