[ruby-cvs:70440] k0kubun:r63350 (trunk): _mjit_compile_send.erb: inline recursive call

k0kubun at ruby-lang.org k0kubun at ruby-lang.org
Tue May 8 01:16:59 JST 2018


k0kubun	2018-05-08 01:16:59 +0900 (Tue, 08 May 2018)

  New Revision: 63350

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

  Log:
    _mjit_compile_send.erb: inline recursive call
    
    mjit_compile.c: propagate funcname to compile_insn
    
    test_jit.rb: add test covering this behavior
    
    * Benchmark
    
    ```
    require 'benchmark_driver'
    
    Benchmark.driver(runner: :time, repeat_count: 4) do |x|
      x.prelude %{
        def fib(x)
          return x if x == 0 || x == 1
          fib(x-1) + fib(x-2)
        end
      }
      x.report 'fib(40)'
      x.loop_count 1
    
      x.rbenv(
        'before,--jit',
        'before',
        'after,--jit',
        'after',
      )
      x.verbose
    end
    ```
    
    ```
    before,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux]
    before: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux]
    after,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux]
    last_commit=_mjit_compile_send.erb: inline recursive call
    after: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux]
    last_commit=_mjit_compile_send.erb: inline recursive call
    Calculating -------------------------------------
                         before,--jit      before  after,--jit       after
                 fib(40)        2.886       8.685        2.562       8.800 s -       1.000 times
    
    Comparison:
                              fib(40)
             after,--jit:         2.6 s
            before,--jit:         2.9 s - 1.13x  slower
                  before:         8.7 s - 3.39x  slower
                   after:         8.8 s - 3.44x  slower
    
    ```

  Modified files:
    trunk/mjit_compile.c
    trunk/test/ruby/test_jit.rb
    trunk/tool/ruby_vm/views/_mjit_compile_send.erb


More information about the ruby-cvs mailing list