зеркало из https://github.com/github/ruby.git
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c0181f31ff
Коммит
fc2764e58c
|
@ -819,8 +819,8 @@ invokeblock
|
|||
}
|
||||
|
||||
val = vm_invoke_block(ec, GET_CFP(), &calling, ci, block_handler);
|
||||
if (val == Qundef) {
|
||||
EXEC_EC_CFP(TRUE);
|
||||
if (val == Qundef && (val = mjit_exec(ec)) == Qundef) {
|
||||
EXEC_EC_CFP(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче