fast-ruby
fast-ruby copied to clipboard
Expand README with Ruby version and AS core.
Background #4
Include the ruby version for the timings in the README. Also maybe expand into some variants using popular core extensions provided by ActiveSupport.
Just a couple of example that show how version/vm (amongst other things) matter:
~/code/ruby/fast-ruby >rvm 2.1.3,1.7.12 do ruby -v code/general/begin-rescue-vs-respond-to.rb
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0]
Calculating -------------------------------------
begin...rescue 28070 i/100ms
respond_to? 81462 i/100ms
-------------------------------------------------
begin...rescue 296882.8 (±21.4%) i/s - 1403500 in 5.018987s
respond_to? 2754475.6 (±14.1%) i/s - 13441230 in 5.001875s
Comparison:
respond_to?: 2754475.6 i/s
begin...rescue: 296882.8 i/s - 9.28x slower
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_11-b12 +indy [darwin-x86_64]
Calculating -------------------------------------
begin...rescue 392 i/100ms
respond_to? 151301 i/100ms
-------------------------------------------------
begin...rescue 10151.7 (±18.6%) i/s - 48608 in 5.006001s
respond_to? 8106945.0 (±15.3%) i/s - 39186959 in 4.980999s
Comparison:
respond_to?: 8106945.0 i/s
begin...rescue: 10151.7 i/s - 798.58x slower
~/code/ruby/fast-ruby >rvm 2.1.3,1.7.12 do ruby -v code/hash/fetch-vs-fetch-with-block.rb
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0]
Calculating -------------------------------------
Hash#fetch + arg 12359 i/100ms
Hash#fetch + block 94092 i/100ms
-------------------------------------------------
Hash#fetch + arg 143501.8 (±25.6%) i/s - 655027 in 5.036688s
Hash#fetch + block 4102310.2 (±19.3%) i/s - 19288860 in 5.023400s
Comparison:
Hash#fetch + block: 4102310.2 i/s
Hash#fetch + arg: 143501.8 i/s - 28.59x slower
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_11-b12 +indy [darwin-x86_64]
Calculating -------------------------------------
Hash#fetch + arg 19338 i/100ms
Hash#fetch + block 96129 i/100ms
-------------------------------------------------
Hash#fetch + arg 1861955.2 (±19.4%) i/s - 8798790 in 4.969999s
Hash#fetch + block 8698784.1 (±13.5%) i/s - 42392889 in 4.990000s
Comparison:
Hash#fetch + block: 8698784.1 i/s
Hash#fetch + arg: 1861955.2 i/s - 4.67x slower
Or maybe we setup travis CI to run all versions for us? And README put benchamark result in 2.2 as an idea. If people are curious, check out results on Travis?
:+1: Good idea :exclamation: :grey_exclamation:
Though I wonder if Travis will use workers with the same hardware when running against multiple versions...
Added Travis in #7. I think only to see one is faster than another (> 12%) then it's okay. :simile:
can this be closed now that travis is active?
I think this project is here to show what is faster, not the actual speed. So running on different hardware across runs is ok as long as people are not comparing the various runs
Closing this issue since it has been implemented.