diff options
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/bm_vm2_poly_singleton.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/benchmark/bm_vm2_poly_singleton.rb b/benchmark/bm_vm2_poly_singleton.rb new file mode 100644 index 0000000000..0dba4320c4 --- /dev/null +++ b/benchmark/bm_vm2_poly_singleton.rb @@ -0,0 +1,14 @@ +class C1 + def m; 1; end +end + +o1 = C1.new +o2 = C1.new +o2.singleton_class + +i = 0 +while i<6_000_000 # benchmark loop 2 + o = (i % 2 == 0) ? o1 : o2 + o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m + i += 1 +end |