mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
7982dc1dfd
for opt_* insns.
opt_eq handles rb_obj_equal inside opt_eq, and all other cfunc is
handled by opt_send_without_block. Therefore we can't decide which insn
should be generated by checking whether it's cfunc cc or not.
```
$ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark/mjit_opt_cc_insns.yml --repeat-count=4
before --jit: ruby 2.8.0dev (2020-06-26T05:21:43Z master 9dbc2294a6
) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-26T06:30:18Z master 75cece1b0b) +JIT [x86_64-linux]
last_commit=Decide JIT-ed insn based on cached cfunc
Calculating -------------------------------------
before --jit after --jit
mjit_nil?(1) 73.878M 74.021M i/s - 40.000M times in 0.541432s 0.540391s
mjit_not(1) 72.635M 74.601M i/s - 40.000M times in 0.550702s 0.536187s
mjit_eq(1, nil) 7.331M 7.445M i/s - 8.000M times in 1.091211s 1.074596s
mjit_eq(nil, 1) 49.450M 64.711M i/s - 8.000M times in 0.161781s 0.123627s
Comparison:
mjit_nil?(1)
after --jit: 74020528.4 i/s
before --jit: 73878185.9 i/s - 1.00x slower
mjit_not(1)
after --jit: 74600882.0 i/s
before --jit: 72634507.6 i/s - 1.03x slower
mjit_eq(1, nil)
after --jit: 7444657.4 i/s
before --jit: 7331304.3 i/s - 1.02x slower
mjit_eq(nil, 1)
after --jit: 64710790.6 i/s
before --jit: 49449507.4 i/s - 1.31x slower
```
27 lines
492 B
YAML
27 lines
492 B
YAML
# opt_* insns using vm_method_cfunc_is with send-compatible operands:
|
|
# * opt_nil_p
|
|
# * opt_not
|
|
# * opt_eq
|
|
type: lib/benchmark_driver/runner/mjit
|
|
prelude: |
|
|
def mjit_nil?(obj)
|
|
obj.nil?
|
|
end
|
|
|
|
def mjit_not(obj)
|
|
!obj
|
|
end
|
|
|
|
def mjit_eq(a, b)
|
|
a == b
|
|
end
|
|
|
|
benchmark:
|
|
- script: mjit_nil?(1)
|
|
loop_count: 40000000
|
|
- script: mjit_not(1)
|
|
loop_count: 40000000
|
|
- script: mjit_eq(1, nil)
|
|
loop_count: 8000000
|
|
- script: mjit_eq(nil, 1)
|
|
loop_count: 8000000
|