aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 16:28:34 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 16:28:34 +0000
commit526a37163a0a59bdd37cef8d9a8e23f8995e6421 (patch)
tree24b454ee3370b772d5bd248398e1a8fa8dd4f328 /benchmark
parent167dcd48d6879ad7d9f7107dc72dad93c66a84b9 (diff)
downloadruby-526a37163a0a59bdd37cef8d9a8e23f8995e6421.tar.gz
benchmark/vm1_*.yml: abstract away the while loop
benchmark/driver.rb had removed the cost for while loop in benchmark/bm_vm1_*.rb, and benchmark_driver.gem can achieve the same thing with `loop_count`. But unfortunately current benchmark_driver.gem can't solve it only for vm1_yield.yml... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark')
-rwxr-xr-xbenchmark/driver.rb6
-rw-r--r--benchmark/vm1_attr_ivar.yml27
-rw-r--r--benchmark/vm1_attr_ivar_set.yml27
-rw-r--r--benchmark/vm1_block.yml18
-rw-r--r--benchmark/vm1_blockparam.yml15
-rw-r--r--benchmark/vm1_blockparam_call.yml17
-rw-r--r--benchmark/vm1_blockparam_pass.yml25
-rw-r--r--benchmark/vm1_blockparam_yield.yml17
-rw-r--r--benchmark/vm1_const.yml15
-rw-r--r--benchmark/vm1_ensure.yml10
-rw-r--r--benchmark/vm1_float_simple.yml14
-rw-r--r--benchmark/vm1_gc_short_lived.yml18
-rw-r--r--benchmark/vm1_gc_short_with_complex_long.yml48
-rw-r--r--benchmark/vm1_gc_short_with_long.yml25
-rw-r--r--benchmark/vm1_gc_short_with_symbol.yml26
-rw-r--r--benchmark/vm1_gc_wb_ary.yml23
-rw-r--r--benchmark/vm1_gc_wb_ary_promoted.yml28
-rw-r--r--benchmark/vm1_gc_wb_obj.yml29
-rw-r--r--benchmark/vm1_gc_wb_obj_promoted.yml33
-rw-r--r--benchmark/vm1_ivar.yml13
-rw-r--r--benchmark/vm1_ivar_set.yml10
-rw-r--r--benchmark/vm1_length.yml15
-rw-r--r--benchmark/vm1_lvar_init.yml32
-rw-r--r--benchmark/vm1_lvar_set.yml12
-rw-r--r--benchmark/vm1_neq.yml14
-rw-r--r--benchmark/vm1_not.yml12
-rw-r--r--benchmark/vm1_rescue.yml10
-rw-r--r--benchmark/vm1_simplereturn.yml18
-rw-r--r--benchmark/vm1_swap.yml16
-rw-r--r--benchmark/vm1_yield.yml3
30 files changed, 241 insertions, 335 deletions
diff --git a/benchmark/driver.rb b/benchmark/driver.rb
index efb73b4eed..a38481bb61 100755
--- a/benchmark/driver.rb
+++ b/benchmark/driver.rb
@@ -73,15 +73,13 @@ loop_count: 1
next if @pattern && /#{@pattern}/ !~ File.basename(file)
next if @exclude && /#{@exclude}/ =~ File.basename(file)
case file
- when /bm_(vm[12])_/, /bm_loop_(whileloop2?).rb/
+ when /bm_(vm2)_/, /bm_loop_(whileloop2).rb/
flag[$1] = true
end
file
}.compact
- if flag['vm1'] && !flag['whileloop']
- files << File.join(@dir, 'bm_loop_whileloop.rb')
- elsif flag['vm2'] && !flag['whileloop2']
+ if flag['vm2'] && !flag['whileloop2']
files << File.join(@dir, 'bm_loop_whileloop2.rb')
end
diff --git a/benchmark/vm1_attr_ivar.yml b/benchmark/vm1_attr_ivar.yml
index a5b3b336e1..f714dd9bd9 100644
--- a/benchmark/vm1_attr_ivar.yml
+++ b/benchmark/vm1_attr_ivar.yml
@@ -1,17 +1,14 @@
+prelude: |
+ class C
+ attr_reader :a, :b
+ def initialize
+ @a = nil
+ @b = nil
+ end
+ end
+ obj = C.new
benchmark:
vm1_attr_ivar: |
- class C
- attr_reader :a, :b
- def initialize
- @a = nil
- @b = nil
- end
- end
- obj = C.new
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- j = obj.a
- k = obj.b
- end
-loop_count: 1
+ j = obj.a
+ k = obj.b
+loop_count: 30000000
diff --git a/benchmark/vm1_attr_ivar_set.yml b/benchmark/vm1_attr_ivar_set.yml
index 2f3cb82775..f383e59ef4 100644
--- a/benchmark/vm1_attr_ivar_set.yml
+++ b/benchmark/vm1_attr_ivar_set.yml
@@ -1,17 +1,14 @@
+prelude: |
+ class C
+ attr_accessor :a, :b
+ def initialize
+ @a = nil
+ @b = nil
+ end
+ end
+ obj = C.new
benchmark:
vm1_attr_ivar_set: |
- class C
- attr_accessor :a, :b
- def initialize
- @a = nil
- @b = nil
- end
- end
- obj = C.new
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- obj.a = 1
- obj.b = 2
- end
-loop_count: 1
+ obj.a = 1
+ obj.b = 2
+loop_count: 30000000
diff --git a/benchmark/vm1_block.yml b/benchmark/vm1_block.yml
index 6e60f14c8e..ac7c940f93 100644
--- a/benchmark/vm1_block.yml
+++ b/benchmark/vm1_block.yml
@@ -1,13 +1,9 @@
+prelude: |
+ def m
+ yield
+ end
benchmark:
vm1_block: |
- def m
- yield
- end
-
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- m{
- }
- end
-loop_count: 1
+ m{
+ }
+loop_count: 30000000
diff --git a/benchmark/vm1_blockparam.yml b/benchmark/vm1_blockparam.yml
index 7d670f7d82..2e25f4466f 100644
--- a/benchmark/vm1_blockparam.yml
+++ b/benchmark/vm1_blockparam.yml
@@ -1,11 +1,8 @@
+prelude: |
+ def m &b
+ end
benchmark:
- vm1_blockparam: |
- def m &b
- end
+ vm1_blockparam: 'm{}
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- m{}
- end
-loop_count: 1
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_blockparam_call.yml b/benchmark/vm1_blockparam_call.yml
index 445ac5150d..ca43aaf48c 100644
--- a/benchmark/vm1_blockparam_call.yml
+++ b/benchmark/vm1_blockparam_call.yml
@@ -1,12 +1,9 @@
+prelude: |
+ def m &b
+ b.call
+ end
benchmark:
- vm1_blockparam_call: |
- def m &b
- b.call
- end
+ vm1_blockparam_call: 'm{}
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- m{}
- end
-loop_count: 1
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_blockparam_pass.yml b/benchmark/vm1_blockparam_pass.yml
index 951518b5f6..416170800e 100644
--- a/benchmark/vm1_blockparam_pass.yml
+++ b/benchmark/vm1_blockparam_pass.yml
@@ -1,16 +1,13 @@
-benchmark:
- vm1_blockparam_pass: |
- def bp_yield
- yield
- end
+prelude: |
+ def bp_yield
+ yield
+ end
- def bp_pass &b
- bp_yield &b
- end
+ def bp_pass &b
+ bp_yield &b
+ end
+benchmark:
+ vm1_blockparam_pass: 'bp_pass{}
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- bp_pass{}
- end
-loop_count: 1
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_blockparam_yield.yml b/benchmark/vm1_blockparam_yield.yml
index 2b55be8486..bb1e877ea9 100644
--- a/benchmark/vm1_blockparam_yield.yml
+++ b/benchmark/vm1_blockparam_yield.yml
@@ -1,12 +1,9 @@
+prelude: |
+ def bp_yield &b
+ yield
+ end
benchmark:
- vm1_blockparam_yield: |
- def bp_yield &b
- yield
- end
+ vm1_blockparam_yield: 'bp_yield{}
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- bp_yield{}
- end
-loop_count: 1
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_const.yml b/benchmark/vm1_const.yml
index 2145e2675f..c0a841ee56 100644
--- a/benchmark/vm1_const.yml
+++ b/benchmark/vm1_const.yml
@@ -1,11 +1,8 @@
+prelude: 'Const = 1
+
+'
benchmark:
vm1_const: |
- Const = 1
-
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- j = Const
- k = Const
- end
-loop_count: 1
+ j = Const
+ k = Const
+loop_count: 30000000
diff --git a/benchmark/vm1_ensure.yml b/benchmark/vm1_ensure.yml
index 2b2cef529a..24229adf56 100644
--- a/benchmark/vm1_ensure.yml
+++ b/benchmark/vm1_ensure.yml
@@ -1,13 +1,9 @@
benchmark:
vm1_ensure: |
- i = 0
- while i<30_000_000 # benchmark loop 1
- i += 1
+ begin
begin
- begin
- ensure
- end
ensure
end
+ ensure
end
-loop_count: 1
+loop_count: 30000000
diff --git a/benchmark/vm1_float_simple.yml b/benchmark/vm1_float_simple.yml
index a99f968457..4e9ad1852b 100644
--- a/benchmark/vm1_float_simple.yml
+++ b/benchmark/vm1_float_simple.yml
@@ -1,10 +1,8 @@
+prelude: |
+ f = 0.0
benchmark:
vm1_float_simple: |
- i = 0.0; f = 0.0
- while i<30_000_000
- i += 1
- f += 0.1; f -= 0.1
- f += 0.1; f -= 0.1
- f += 0.1; f -= 0.1
- end
-loop_count: 1
+ f += 0.1; f -= 0.1
+ f += 0.1; f -= 0.1
+ f += 0.1; f -= 0.1
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_short_lived.yml b/benchmark/vm1_gc_short_lived.yml
index c682715cb5..8fdcb7371d 100644
--- a/benchmark/vm1_gc_short_lived.yml
+++ b/benchmark/vm1_gc_short_lived.yml
@@ -1,13 +1,9 @@
benchmark:
vm1_gc_short_lived: |
- i = 0
- while i<30_000_000 # while loop 1
- a = '' # short-lived String
- b = ''
- c = ''
- d = ''
- e = ''
- f = ''
- i+=1
- end
-loop_count: 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_short_with_complex_long.yml b/benchmark/vm1_gc_short_with_complex_long.yml
index 2a3ba2f0c8..c22ea74a60 100644
--- a/benchmark/vm1_gc_short_with_complex_long.yml
+++ b/benchmark/vm1_gc_short_with_complex_long.yml
@@ -1,29 +1,25 @@
-benchmark:
- vm1_gc_short_with_complex_long: |
- def nested_hash h, n
- if n == 0
- ''
- else
- 10.times{
- h[Object.new] = nested_hash(h, n-1)
- }
- end
+prelude: |
+ def nested_hash h, n
+ if n == 0
+ ''
+ else
+ 10.times{
+ h[Object.new] = nested_hash(h, n-1)
+ }
end
+ end
- long_lived = Hash.new
- nested_hash long_lived, 6
-
- GC.start
- GC.start
+ long_lived = Hash.new
+ nested_hash long_lived, 6
- i = 0
- while i<30_000_000 # while loop 1
- a = '' # short-lived String
- b = ''
- c = ''
- d = ''
- e = ''
- f = ''
- i+=1
- end
-loop_count: 1
+ GC.start
+ GC.start
+benchmark:
+ vm1_gc_short_with_complex_long: |
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_short_with_long.yml b/benchmark/vm1_gc_short_with_long.yml
index f173ec0ca5..c731aae548 100644
--- a/benchmark/vm1_gc_short_with_long.yml
+++ b/benchmark/vm1_gc_short_with_long.yml
@@ -1,16 +1,13 @@
+prelude: |
+ long_lived = Array.new(1_000_000){|i| "#{i}"}
+ GC.start
+ GC.start
benchmark:
vm1_gc_short_with_long: |
- long_lived = Array.new(1_000_000){|i| "#{i}"}
- GC.start
- GC.start
- i = 0
- while i<30_000_000 # while loop 1
- a = '' # short-lived String
- b = ''
- c = ''
- d = ''
- e = ''
- f = ''
- i+=1
- end
-loop_count: 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_short_with_symbol.yml b/benchmark/vm1_gc_short_with_symbol.yml
index c78cd34f6f..7fc1abedd8 100644
--- a/benchmark/vm1_gc_short_with_symbol.yml
+++ b/benchmark/vm1_gc_short_with_symbol.yml
@@ -1,19 +1,13 @@
prelude: |
- # make many symbols
+ 50_000.times{|i| sym = "sym#{i}".to_sym}
+ GC.start
+ GC.start
benchmark:
vm1_gc_short_with_symbol: |
- 50_000.times{|i| sym = "sym#{i}".to_sym}
- GC.start
- GC.start
-
- i = 0
- while i<30_000_000 # while loop 1
- a = '' # short-lived String
- b = ''
- c = ''
- d = ''
- e = ''
- f = ''
- i+=1
- end
-loop_count: 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_wb_ary.yml b/benchmark/vm1_gc_wb_ary.yml
index 62b37815de..50fb4b6f84 100644
--- a/benchmark/vm1_gc_wb_ary.yml
+++ b/benchmark/vm1_gc_wb_ary.yml
@@ -1,15 +1,12 @@
-benchmark:
- vm1_gc_wb_ary: |
- short_lived_ary = []
+prelude: |
+ short_lived_ary = []
- if RUBY_VERSION >= "2.2.0"
- GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true)
- end
+ if RUBY_VERSION >= "2.2.0"
+ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true)
+ end
- i = 0
- short_lived = ''
- while i<30_000_000 # while loop 1
- short_lived_ary[0] = short_lived # write barrier
- i+=1
- end
-loop_count: 1
+ short_lived = ''
+benchmark:
+ vm1_gc_wb_ary: |
+ short_lived_ary[0] = short_lived # write barrier
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_wb_ary_promoted.yml b/benchmark/vm1_gc_wb_ary_promoted.yml
index 5befcc9b5d..cf9b5de005 100644
--- a/benchmark/vm1_gc_wb_ary_promoted.yml
+++ b/benchmark/vm1_gc_wb_ary_promoted.yml
@@ -1,17 +1,15 @@
-benchmark:
- vm1_gc_wb_ary_promoted: |
- long_lived = []
+prelude: |
+ long_lived = []
+
+ if RUBY_VERSION > "2.2.0"
+ 3.times{ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true) }
+ elsif
+ GC.start
+ end
- if RUBY_VERSION > "2.2.0"
- 3.times{ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true) }
- elsif
- GC.start
- end
+ short_lived = ''
- i = 0
- short_lived = ''
- while i<30_000_000 # while loop 1
- long_lived[0] = short_lived # write barrier
- i+=1
- end
-loop_count: 1
+benchmark:
+ vm1_gc_wb_ary_promoted: |
+ long_lived[0] = short_lived # write barrier
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_wb_obj.yml b/benchmark/vm1_gc_wb_obj.yml
index 0adcd84ee3..9dc08e7e1a 100644
--- a/benchmark/vm1_gc_wb_obj.yml
+++ b/benchmark/vm1_gc_wb_obj.yml
@@ -1,18 +1,15 @@
-benchmark:
- vm1_gc_wb_obj: |
- class C
- attr_accessor :foo
- end
- short_lived_obj = C.new
+prelude: |
+ class C
+ attr_accessor :foo
+ end
+ short_lived_obj = C.new
- if RUBY_VERSION >= "2.2.0"
- GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true)
- end
+ if RUBY_VERSION >= "2.2.0"
+ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true)
+ end
- i = 0
- short_lived = ''
- while i<30_000_000 # while loop 1
- short_lived_obj.foo = short_lived # write barrier
- i+=1
- end
-loop_count: 1
+ short_lived = ''
+benchmark:
+ vm1_gc_wb_obj: |
+ short_lived_obj.foo = short_lived # write barrier
+loop_count: 30000000
diff --git a/benchmark/vm1_gc_wb_obj_promoted.yml b/benchmark/vm1_gc_wb_obj_promoted.yml
index 56abca0c3c..26859d2a52 100644
--- a/benchmark/vm1_gc_wb_obj_promoted.yml
+++ b/benchmark/vm1_gc_wb_obj_promoted.yml
@@ -1,20 +1,17 @@
-benchmark:
- vm1_gc_wb_obj_promoted: |
- class C
- attr_accessor :foo
- end
- long_lived = C.new
+prelude: |
+ class C
+ attr_accessor :foo
+ end
+ long_lived = C.new
- if RUBY_VERSION >= "2.2.0"
- 3.times{ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true) }
- elsif
- GC.start
- end
+ if RUBY_VERSION >= "2.2.0"
+ 3.times{ GC.start(full_mark: false, immediate_mark: true, immediate_sweep: true) }
+ elsif
+ GC.start
+ end
- i = 0
- short_lived = ''
- while i<30_000_000 # while loop 1
- long_lived.foo = short_lived # write barrier
- i+=1
- end
-loop_count: 1
+ short_lived = ''
+benchmark:
+ vm1_gc_wb_obj_promoted: |
+ long_lived.foo = short_lived # write barrier
+loop_count: 30000000
diff --git a/benchmark/vm1_ivar.yml b/benchmark/vm1_ivar.yml
index ccbe656e32..7aa6fac729 100644
--- a/benchmark/vm1_ivar.yml
+++ b/benchmark/vm1_ivar.yml
@@ -1,11 +1,6 @@
+prelude: "@a = 1\n"
benchmark:
vm1_ivar: |
- @a = 1
-
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- j = @a
- k = @a
- end
-loop_count: 1
+ j = @a
+ k = @a
+loop_count: 30000000
diff --git a/benchmark/vm1_ivar_set.yml b/benchmark/vm1_ivar_set.yml
index a842010014..6f19412d16 100644
--- a/benchmark/vm1_ivar_set.yml
+++ b/benchmark/vm1_ivar_set.yml
@@ -1,9 +1,5 @@
benchmark:
vm1_ivar_set: |
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- @a = 1
- @b = 2
- end
-loop_count: 1
+ @a = 1
+ @b = 2
+loop_count: 30000000
diff --git a/benchmark/vm1_length.yml b/benchmark/vm1_length.yml
index 030b6c510c..a18e2ca2e6 100644
--- a/benchmark/vm1_length.yml
+++ b/benchmark/vm1_length.yml
@@ -1,11 +1,8 @@
+prelude: |
+ a = 'abc'
+ b = [1, 2, 3]
benchmark:
vm1_length: |
- a = 'abc'
- b = [1, 2, 3]
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- a.length
- b.length
- end
-loop_count: 1
+ a.length
+ b.length
+loop_count: 30000000
diff --git a/benchmark/vm1_lvar_init.yml b/benchmark/vm1_lvar_init.yml
index 468bd24919..23d12550ac 100644
--- a/benchmark/vm1_lvar_init.yml
+++ b/benchmark/vm1_lvar_init.yml
@@ -1,20 +1,16 @@
-benchmark:
- vm1_lvar_init: |
- def m v
- unless v
- # unreachable code
- v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = v10 =
- v11 = v12 = v13 = v14 = v15 = v16 = v17 = v18 = v19 = v20 =
- v21 = v22 = v23 = v24 = v25 = v26 = v27 = v28 = v29 = v30 =
- v31 = v32 = v33 = v34 = v35 = v36 = v37 = v38 = v39 = v40 =
- v41 = v42 = v43 = v44 = v45 = v46 = v47 = v48 = v49 = v50 = 1
- end
+prelude: |
+ def m v
+ unless v
+ # unreachable code
+ v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = v10 =
+ v11 = v12 = v13 = v14 = v15 = v16 = v17 = v18 = v19 = v20 =
+ v21 = v22 = v23 = v24 = v25 = v26 = v27 = v28 = v29 = v30 =
+ v31 = v32 = v33 = v34 = v35 = v36 = v37 = v38 = v39 = v40 =
+ v41 = v42 = v43 = v44 = v45 = v46 = v47 = v48 = v49 = v50 = 1
end
+ end
+benchmark:
+ vm1_lvar_init: 'm i
- i = 0
-
- while i<30_000_000 # while loop 1
- i += 1
- m i
- end
-loop_count: 1
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_lvar_set.yml b/benchmark/vm1_lvar_set.yml
index 020679933c..bd6c3f8156 100644
--- a/benchmark/vm1_lvar_set.yml
+++ b/benchmark/vm1_lvar_set.yml
@@ -1,8 +1,6 @@
benchmark:
- vm1_lvar_set: |
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- a = b = c = d = e = f = g = h = j = k = l = m = n = o = p = q = r = 1
- end
-loop_count: 1
+ vm1_lvar_set: 'a = b = c = d = e = f = g = h = j = k = l = m = n = o = p = q = r
+ = 1
+
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_neq.yml b/benchmark/vm1_neq.yml
index 8ce480cbf4..65a8128dda 100644
--- a/benchmark/vm1_neq.yml
+++ b/benchmark/vm1_neq.yml
@@ -1,11 +1,7 @@
+prelude: |
+ obj1 = Object.new
+ obj2 = Object.new
benchmark:
vm1_neq: |
- i = 0
- obj1 = Object.new
- obj2 = Object.new
-
- while i<30_000_000 # while loop 1
- i += 1
- obj1 != obj2
- end
-loop_count: 1
+ obj1 != obj2
+loop_count: 30000000
diff --git a/benchmark/vm1_not.yml b/benchmark/vm1_not.yml
index a38dfc7343..0fb7b282a9 100644
--- a/benchmark/vm1_not.yml
+++ b/benchmark/vm1_not.yml
@@ -1,10 +1,6 @@
+prelude: |
+ obj = Object.new
benchmark:
vm1_not: |
- i = 0
- obj = Object.new
-
- while i<30_000_000 # while loop 1
- i += 1
- !obj
- end
-loop_count: 1
+ !obj
+loop_count: 30000000
diff --git a/benchmark/vm1_rescue.yml b/benchmark/vm1_rescue.yml
index 539a6e88f7..a175b823af 100644
--- a/benchmark/vm1_rescue.yml
+++ b/benchmark/vm1_rescue.yml
@@ -1,10 +1,6 @@
benchmark:
vm1_rescue: |
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- begin
- rescue
- end
+ begin
+ rescue
end
-loop_count: 1
+loop_count: 30000000
diff --git a/benchmark/vm1_simplereturn.yml b/benchmark/vm1_simplereturn.yml
index cfe1f74489..32fcc02f93 100644
--- a/benchmark/vm1_simplereturn.yml
+++ b/benchmark/vm1_simplereturn.yml
@@ -1,11 +1,9 @@
+prelude: |
+ def m
+ return 1
+ end
benchmark:
- vm1_simplereturn: |
- def m
- return 1
- end
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- m
- end
-loop_count: 1
+ vm1_simplereturn: 'm
+
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_swap.yml b/benchmark/vm1_swap.yml
index 789aa7d42e..90683880f1 100644
--- a/benchmark/vm1_swap.yml
+++ b/benchmark/vm1_swap.yml
@@ -1,10 +1,8 @@
+prelude: |
+ a = 1
+ b = 2
benchmark:
- vm1_swap: |
- a = 1
- b = 2
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- a, b = b, a
- end
-loop_count: 1
+ vm1_swap: 'a, b = b, a
+
+'
+loop_count: 30000000
diff --git a/benchmark/vm1_yield.yml b/benchmark/vm1_yield.yml
index b67ebb4d95..ae1f9316f9 100644
--- a/benchmark/vm1_yield.yml
+++ b/benchmark/vm1_yield.yml
@@ -1,8 +1,9 @@
+# while loop cost is not removed due to benchmark_driver.gem's limitation
benchmark:
vm1_yield: |
def m
i = 0
- while i<30_000_000 # while loop 1
+ while i<30_000_000
i += 1
yield
end