Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
30 changed files
with
241 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.