[ruby-cvs:69806] k0kubun:r62643 (trunk): insns.def: unwrap vm_exec for yield

k0kubun at ruby-lang.org k0kubun at ruby-lang.org
Sat Mar 3 13:50:15 JST 2018


k0kubun	2018-03-03 13:50:14 +0900 (Sat, 03 Mar 2018)

  New Revision: 62643

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62643

  Log:
    insns.def: unwrap vm_exec for yield
    
    Outer vm_exec can catch longjmp. We don't need to call vm_exec first
    here.
    
    This optimizes JIT-ed yield:
    
    * Benchmark script
    
    ```
    require 'benchmark_driver'
    
    Benchmark.driver do |x|
      x.prelude %{
        def yielder
          yield + 1
        end
      }
      x.report 'yielder', %{
        yielder { 1 }
      }
      x.loop_count 300_000_000
    
      x.rbenv 'before', 'before,--jit', 'after', 'after,--jit'
      x.verbose
    end
    ```
    
    * Result
    
    before: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux]
    before,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux]
    after: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux]
    last_commit=insns.def: unwrap vm_exec for yield
    after,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux]
    last_commit=insns.def: unwrap vm_exec for yield
    Calculating -------------------------------------
                             before  before,--jit       after  after,--jit
                 yielder    37.214M       29.222M     35.904M      38.035M i/s -    300.000M times in 8.061581s 10.266312s 8.355716s 7.887447s
    
    Comparison:
                              yielder
             after,--jit:  38035121.0 i/s
                  before:  37213544.0 i/s - 1.02x  slower
                   after:  35903565.7 i/s - 1.06x  slower
            before,--jit:  29221787.6 i/s - 1.30x  slower

  Modified files:
    trunk/insns.def


More information about the ruby-cvs mailing list