зеркало из https://github.com/github/ruby.git
Remove MJIT-specific benchmarks
This commit is contained in:
Родитель
2702d615f5
Коммит
66c4dc1592
|
@ -1,34 +0,0 @@
|
|||
require 'benchmark_driver/struct'
|
||||
require 'benchmark_driver/metric'
|
||||
require 'erb'
|
||||
|
||||
# A runner to measure after-JIT performance easily
|
||||
class BenchmarkDriver::Runner::Mjit < BenchmarkDriver::Runner::Ips
|
||||
# JobParser returns this, `BenchmarkDriver::Runner.runner_for` searches "*::Job"
|
||||
Job = Class.new(BenchmarkDriver::DefaultJob)
|
||||
|
||||
# Dynamically fetched and used by `BenchmarkDriver::JobParser.parse`
|
||||
JobParser = BenchmarkDriver::DefaultJobParser.for(klass: Job, metrics: [METRIC]).extend(Module.new{
|
||||
def parse(**)
|
||||
jobs = super
|
||||
jobs.map do |job|
|
||||
job = job.dup
|
||||
job.prelude = "#{job.prelude}\n#{<<~EOS}"
|
||||
if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
|
||||
__bmdv_ruby_i = 0
|
||||
while __bmdv_ruby_i < 10000 # MJIT call threshold
|
||||
#{job.script}
|
||||
__bmdv_ruby_i += 1
|
||||
end
|
||||
RubyVM::MJIT.pause # compile
|
||||
#{job.script}
|
||||
RubyVM::MJIT.resume; RubyVM::MJIT.pause # recompile
|
||||
#{job.script}
|
||||
RubyVM::MJIT.resume; RubyVM::MJIT.pause # recompile 2
|
||||
end
|
||||
EOS
|
||||
job
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
type: lib/benchmark_driver/runner/mjit
|
||||
prelude: |
|
||||
class Bench < Hash
|
||||
def initialize
|
||||
@exivar = nil
|
||||
end
|
||||
|
||||
def exivar
|
||||
@exivar
|
||||
end
|
||||
end
|
||||
|
||||
bench = Bench.new
|
||||
|
||||
benchmark:
|
||||
mjit_exivar: bench.exivar
|
||||
|
||||
loop_count: 200000000
|
|
@ -1,32 +0,0 @@
|
|||
type: lib/benchmark_driver/runner/mjit
|
||||
prelude: |
|
||||
def mjit_abs(int) int.abs end
|
||||
def mjit_bit_length(int) int.bit_length end
|
||||
def mjit_comp(int) ~int end
|
||||
def mjit_even?(int) int.even? end
|
||||
def mjit_integer?(int) int.integer? end
|
||||
def mjit_magnitude(int) int.magnitude end
|
||||
def mjit_odd?(int) int.odd? end
|
||||
def mjit_ord(int) int.ord end
|
||||
def mjit_size(int) int.size end
|
||||
def mjit_to_i(int) int.to_i end
|
||||
def mjit_to_int(int) int.to_int end
|
||||
def mjit_uminus(int) -int end
|
||||
def mjit_zero?(int) int.zero? end
|
||||
|
||||
benchmark:
|
||||
- mjit_abs(-1)
|
||||
- mjit_bit_length(100)
|
||||
- mjit_comp(1)
|
||||
- mjit_even?(2)
|
||||
- mjit_integer?(0)
|
||||
- mjit_magnitude(-1)
|
||||
- mjit_odd?(1)
|
||||
- mjit_ord(1)
|
||||
- mjit_size(1)
|
||||
- mjit_to_i(1)
|
||||
- mjit_to_int(1)
|
||||
- mjit_uminus(1)
|
||||
- mjit_zero?(0)
|
||||
|
||||
loop_count: 40000000
|
|
@ -1,20 +0,0 @@
|
|||
type: lib/benchmark_driver/runner/mjit
|
||||
prelude: |
|
||||
def mjit_class(obj)
|
||||
obj.class
|
||||
end
|
||||
|
||||
def mjit_frozen?(obj)
|
||||
obj.frozen?
|
||||
end
|
||||
|
||||
str = ""
|
||||
fstr = "".freeze
|
||||
|
||||
benchmark:
|
||||
- mjit_class(self)
|
||||
- mjit_class(1)
|
||||
- mjit_frozen?(str)
|
||||
- mjit_frozen?(fstr)
|
||||
|
||||
loop_count: 40000000
|
|
@ -1,8 +0,0 @@
|
|||
type: lib/benchmark_driver/runner/mjit
|
||||
prelude: |
|
||||
def leave
|
||||
nil
|
||||
end
|
||||
benchmark:
|
||||
mjit_leave: leave
|
||||
loop_count: 200000000
|
|
@ -1,27 +0,0 @@
|
|||
# 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
|
|
@ -1,10 +0,0 @@
|
|||
type: lib/benchmark_driver/runner/mjit
|
||||
prelude: |
|
||||
def mjit_struct_aref(struct)
|
||||
struct.aa
|
||||
end
|
||||
struct = Struct.new(:a0, :a1, :a2, :a3, :a4, :a5, :a6, :a7, :a8, :a9, :aa).new
|
||||
|
||||
benchmark: mjit_struct_aref(struct)
|
||||
|
||||
loop_count: 40000000
|
Загрузка…
Ссылка в новой задаче