⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (1.36 KB)
Bug #11901
» openstruct-regression-benchmark.rb
Benchmark to compare 2.2.4 versus 2.3.0 -
amcaplan (Ariel Caplan)
, 12/27/2015 03:35 PM
require
'ostruct'
require
'benchmark/ips'
o
=
OpenStruct
.
new
(
foo: :bar
)
o2
=
OpenStruct
.
new
o2
.
foo
=
:bar
Benchmark
.
ips
do
|
x
|
x
.
report
(
'assigned on initialization'
)
do
o
.
foo
end
x
.
report
(
'assigned after initialization'
)
do
o2
.
foo
end
x
.
compare!
end
__END__
Run on Ruby 2.2.4:
Calculating -------------------------------------
assigned on initialization
133.904k i/100ms
assigned after initialization
133.563k i/100ms
-------------------------------------------------
assigned on initialization
5.374M (± 1.7%) i/s - 26.915M
assigned after initialization
5.290M (± 7.1%) i/s - 26.312M
Comparison:
assigned on initialization: 5374479.2 i/s
assigned after initialization: 5290495.7 i/s - 1.02x slower
Run on Ruby 2.3.0:
Calculating -------------------------------------
assigned on initialization
55.384k i/100ms
assigned after initialization
140.013k i/100ms
-------------------------------------------------
assigned on initialization
850.862k (± 1.8%) i/s - 4.265M
assigned after initialization
6.445M (± 1.9%) i/s - 32.343M
Comparison:
assigned after initialization: 6445171.0 i/s
assigned on initialization: 850862.4 i/s - 7.57x slower
(1-1/1)
Loading...