Skip to content

Instantly share code, notes, and snippets.

@johnd
Created November 13, 2013 14:15
Show Gist options
  • Save johnd/7449801 to your computer and use it in GitHub Desktop.
Save johnd/7449801 to your computer and use it in GitHub Desktop.
Benchmark output for explicit vs implicit returns against all the Rubies randomly installed on my desktop.
john@SLAB:~/Dropbox/Code$ rvm all --verbose do ruby explict_implicit_bm.rb
jruby-1.6.5: jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_51) [darwin-x86_64-java]
Rehearsal --------------------------------------------
explicit 0.397000 0.000000 0.397000 ( 0.368000)
implicit 0.339000 0.000000 0.339000 ( 0.339000)
----------------------------------- total: 0.736000sec
user system total real
explicit 0.340000 0.000000 0.340000 ( 0.340000)
implicit 0.355000 0.000000 0.355000 ( 0.355000)
jruby-1.7.4: jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]
Rehearsal --------------------------------------------
explicit 0.900000 0.030000 0.930000 ( 0.521000)
implicit 0.390000 0.000000 0.390000 ( 0.357000)
----------------------------------- total: 1.320000sec
user system total real
explicit 0.370000 0.000000 0.370000 ( 0.368000)
implicit 0.390000 0.000000 0.390000 ( 0.384000)
Gemset '' does not exist, 'rvm macruby-0.10 do rvm gemset create ' first, or append '--create'.
Gemset '' does not exist, 'rvm maglev-26063 do rvm gemset create ' first, or append '--create'.
maglev-26852: maglev 0.9 (ruby 1.8.7) (2011-09-21 rev 26852-1302-bda8f14) [Darwin x86_64]
ruby: [Error] /Users/john/.rvm/rubies/maglev-26852/gemstone does not appear to be a valid GemStone product directory.
To fix this, set a valid GEMSTONE in your .bashrc
rbx-head: rubinius 1.2.5dev (1.8.7 411a2467 yyyy-mm-dd JI) [x86_64-apple-darwin11.0.0]
Rehearsal --------------------------------------------
explicit 0.507692 0.000104 0.507796 ( 0.491746)
implicit 0.488678 0.000068 0.488746 ( 0.480013)
----------------------------------- total: 0.996542sec
user system total real
explicit 0.225156 0.000024 0.225180 ( 0.225184)
implicit 0.222985 0.000025 0.223010 ( 0.222992)
ree-1.8.7-2010.02: ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.8.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02
Rehearsal --------------------------------------------
explicit 2.380000 0.000000 2.380000 ( 2.430614)
implicit 1.670000 0.000000 1.670000 ( 1.718983)
----------------------------------- total: 4.050000sec
user system total real
explicit 2.310000 0.000000 2.310000 ( 2.312416)
implicit 1.690000 0.000000 1.690000 ( 1.710869)
ree-1.8.7-2011.03: ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.8.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03
Rehearsal --------------------------------------------
explicit 2.090000 0.000000 2.090000 ( 2.091729)
implicit 1.450000 0.000000 1.450000 ( 1.492258)
----------------------------------- total: 3.540000sec
user system total real
explicit 2.110000 0.000000 2.110000 ( 2.104354)
implicit 1.440000 0.000000 1.440000 ( 1.441560)
ruby-1.8.7-p352: ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]
Rehearsal --------------------------------------------
explicit 2.040000 0.000000 2.040000 ( 2.082407)
implicit 1.320000 0.000000 1.320000 ( 1.322298)
----------------------------------- total: 3.360000sec
user system total real
explicit 2.020000 0.000000 2.020000 ( 2.018939)
implicit 1.360000 0.000000 1.360000 ( 1.389295)
ruby-1.9.2-p0: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin11.3.0]
Rehearsal --------------------------------------------
explicit 0.780000 0.000000 0.780000 ( 0.779611)
implicit 0.790000 0.000000 0.790000 ( 0.790240)
----------------------------------- total: 1.570000sec
user system total real
explicit 0.800000 0.000000 0.800000 ( 0.838650)
implicit 0.780000 0.000000 0.780000 ( 0.783845)
ruby-1.9.2-p180: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
Rehearsal --------------------------------------------
explicit 0.770000 0.000000 0.770000 ( 0.769755)
implicit 0.760000 0.000000 0.760000 ( 0.756907)
----------------------------------- total: 1.530000sec
user system total real
explicit 0.760000 0.000000 0.760000 ( 0.757747)
implicit 0.770000 0.000000 0.770000 ( 0.767553)
ruby-1.9.2-p290: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
Rehearsal --------------------------------------------
explicit 0.760000 0.000000 0.760000 ( 0.755057)
implicit 0.770000 0.000000 0.770000 ( 0.839862)
----------------------------------- total: 1.530000sec
user system total real
explicit 0.750000 0.000000 0.750000 ( 0.749637)
implicit 0.760000 0.000000 0.760000 ( 0.764927)
ruby-1.9.3-p0: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin12.2.0]
Rehearsal --------------------------------------------
explicit 0.760000 0.000000 0.760000 ( 0.767132)
implicit 0.760000 0.000000 0.760000 ( 0.760760)
----------------------------------- total: 1.520000sec
user system total real
explicit 0.790000 0.000000 0.790000 ( 0.787345)
implicit 0.800000 0.000000 0.800000 ( 0.841993)
ruby-1.9.3-p374: ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.0]
Rehearsal --------------------------------------------
explicit 0.840000 0.000000 0.840000 ( 0.840365)
implicit 0.770000 0.000000 0.770000 ( 0.769661)
----------------------------------- total: 1.610000sec
user system total real
explicit 0.740000 0.000000 0.740000 ( 0.747272)
implicit 0.770000 0.000000 0.770000 ( 0.813625)
ruby-1.9.3-p448: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
Rehearsal --------------------------------------------
explicit 0.740000 0.000000 0.740000 ( 0.737122)
implicit 0.750000 0.000000 0.750000 ( 0.744864)
----------------------------------- total: 1.490000sec
user system total real
explicit 0.750000 0.000000 0.750000 ( 0.753330)
implicit 0.750000 0.000000 0.750000 ( 0.753751)
ruby-2.0.0-p247: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
Rehearsal --------------------------------------------
explicit 0.870000 0.000000 0.870000 ( 0.873909)
implicit 0.900000 0.000000 0.900000 ( 0.961103)
----------------------------------- total: 1.770000sec
user system total real
explicit 0.910000 0.000000 0.910000 ( 0.912819)
implicit 0.900000 0.000000 0.900000 ( 0.891823)
@nirvdrum
Copy link

Can you post the actual benchmark code please? If JRuby is really slower there, I'd like to get it fixed. I took a best guess at what the script would look like and ran it on JRuby 1.7.8 and found after warm-up that explicit returns were moderately faster than implicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment