Skip to content

Instantly share code, notes, and snippets.

@brixen
Created March 7, 2018 03:50
Show Gist options
  • Save brixen/e6a290311a5d92d5a3421ce5f7f238ec to your computer and use it in GitHub Desktop.
Save brixen/e6a290311a5d92d5a3421ce5f7f238ec to your computer and use it in GitHub Desktop.
rbx 3.19 ~7.7x vs mri 2.2.3
require 'benchmark/ips'
def script
i = 0
while i < 1000_000
i += 1
end
i
end
Benchmark.ips do |x|
x.report 'while', %{ script }
end
$ ruby -v bm_while.rb
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
Warming up --------------------------------------
while 4.000 i/100ms
Calculating -------------------------------------
while 40.641 (± 4.9%) i/s - 204.000 in 5.031193s
$ rbx -v bm_while.rb
rubinius 3.19 (2.2.2 1cc41ddc 2016-02-27 3.5.1 JI) [x86_64-darwin13.4.0]
Warming up --------------------------------------
while 29.000 i/100ms
Calculating -------------------------------------
while 315.140 (± 5.7%) i/s - 1.595k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment