Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Created February 24, 2013 20:16
Show Gist options
  • Save thoughtpolice/5025417 to your computer and use it in GitHub Desktop.
Save thoughtpolice/5025417 to your computer and use it in GitHub Desktop.
Ruby benchmarks
$ rbenv versions
system
1.9.3-p385
* 2.0.0-p0 (set by RBENV_VERSION environment variable)
jruby-1.7.3
$ rbenv shell system
$ rbenv which ruby
/usr/bin/ruby
$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
$ time ruby pidigits.rb 10000 2>&1 > /dev/null
ruby pidigits.rb 10000 2>&1 > /dev/null 35.20s user 0.20s system 99% cpu 35.422 total
$ rbenv shell 1.9.3-p385
$ rbenv which ruby
/Users/a/.rbenv/versions/1.9.3-p385/bin/ruby
$ ruby --version
ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin12.2.1]
$ time ruby pidigits.rb 10000 2>&1 > /dev/null
ruby pidigits.rb 10000 2>&1 > /dev/null 17.51s user 0.11s system 99% cpu 17.639 total
$ rbenv shell jruby-1.7.3
$ rbenv which ruby
/Users/a/.rbenv/versions/jruby-1.7.3/bin/ruby
$ ruby --version
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_10-b18 [darwin-x86_64]
$ time ruby pidigits.rb 10000 2>&1 > /dev/null
ruby pidigits.rb 10000 2>&1 > /dev/null 9.43s user 0.23s system 121% cpu 7.959 total
$ rbenv shell 2.0.0-p0
$ rbenv which ruby
/Users/a/.rbenv/versions/2.0.0-p0/bin/ruby
$ ruby --version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
$ time ruby pidigits.rb 10000 2>&1 > /dev/null
ruby pidigits.rb 10000 2>&1 > /dev/null 4.64s user 0.27s system 99% cpu 4.927 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment