1. 18 10月, 2014 1 次提交
    • C
      Replace (slower) block.call with (faster) yield · 6aa115e4
      claudiob 提交于
      Performance optimization: `yield` with an implicit `block` is faster than `block.call`.
      See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark:
      
      ```ruby
      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
      ```
      6aa115e4
  2. 17 10月, 2014 9 次提交
  3. 16 10月, 2014 29 次提交
  4. 15 10月, 2014 1 次提交