mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Added synthetic torture test with 30K tiny methods
This commit is contained in:
parent
8357e8e514
commit
d2ad0a1175
2 changed files with 121065 additions and 0 deletions
121018
bootstraptest/test_ujit_many_funs.rb
Normal file
121018
bootstraptest/test_ujit_many_funs.rb
Normal file
File diff suppressed because it is too large
Load diff
47
misc/gen_call_test.rb
Normal file
47
misc/gen_call_test.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
NUM_LEVELS = 30
|
||||
FNS_PER_LEVEL = 1000
|
||||
|
||||
$out = ""
|
||||
|
||||
def addln(str = "")
|
||||
$out << str << "\n"
|
||||
end
|
||||
|
||||
NUM_LEVELS.times do |l_no|
|
||||
FNS_PER_LEVEL.times do |f_no|
|
||||
f_name = "fun_l#{l_no}_n#{f_no}"
|
||||
|
||||
if l_no < NUM_LEVELS - 1
|
||||
callee_no = rand(0...FNS_PER_LEVEL)
|
||||
callee_name = "fun_l#{l_no+1}_n#{callee_no}"
|
||||
else
|
||||
callee_name = "inc"
|
||||
end
|
||||
|
||||
addln("def #{f_name}()")
|
||||
addln(" #{callee_name}")
|
||||
addln("end")
|
||||
addln()
|
||||
end
|
||||
end
|
||||
|
||||
addln("@a = 0")
|
||||
addln("@b = 0")
|
||||
addln("@c = 0")
|
||||
addln("@d = 0")
|
||||
addln("@count = 0")
|
||||
addln("def inc()")
|
||||
addln(" @count += 1")
|
||||
addln("end")
|
||||
|
||||
# 100K times
|
||||
addln("100000.times do")
|
||||
FNS_PER_LEVEL.times do |f_no|
|
||||
f_name = "fun_l0_n#{f_no}"
|
||||
addln(" #{f_name}")
|
||||
end
|
||||
addln("end")
|
||||
|
||||
addln("puts @count")
|
||||
|
||||
puts($out)
|
Loading…
Reference in a new issue