mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
f883d6219e
The vm1_ prefix and vm2_ had had special meaning until820ad9cb1d
and12068aa4e9
. AFAIK there's no special meaning in vm3_ prefix. As they have confused people (like "In `benchmark` what is difference between `vm1_`, `vm2_` and `vm3_`"), I'd like to remove the obsoleted prefix as we obviated that two years ago.
23 lines
532 B
YAML
23 lines
532 B
YAML
# loop_count is not utilized since `i` is involved in the script
|
|
benchmark:
|
|
vm_case_lit: |
|
|
i = 0
|
|
@ret = [ "foo", true, false, :sym, 6, nil, 0.1, 0xffffffffffffffff ]
|
|
def foo(i)
|
|
@ret[i % @ret.size]
|
|
end
|
|
|
|
while i<6_000_000
|
|
case foo(i)
|
|
when "foo" then :foo
|
|
when true then true
|
|
when false then false
|
|
when :sym then :sym
|
|
when 6 then :fix
|
|
when nil then nil
|
|
when 0.1 then :float
|
|
when 0xffffffffffffffff then :big
|
|
end
|
|
i += 1
|
|
end
|
|
loop_count: 1
|