Testing loop speeds in RubyMotion
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
resources
spec
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile

README.md

rm-loop-speed

Testing loop speeds in RubyMotion

You must run with mode=release for real results.

i.e. bundle exec rake mode=release

Example output

****************************************************************************************************
 Testing Loop Speeds in RubyMotion
    Benchmark 1 uses `for i in 1..n`
    Benchmark 2 uses `n.times`
    Benchmark 3 uses `1.upto(n)`
****************************************************************************************************

Testing with n = 500

      user     system      total        real
  0.000000   0.000000   0.000000 (  0.000329)
  0.000000   0.000000   0.000000 (  0.000147)
  0.000000   0.000000   0.000000 (  0.000160)
----------------------------------------------------------------------------------------------------
Testing with n = 5000

      user     system      total        real
  0.010000   0.000000   0.010000 (  0.001789)
  0.000000   0.000000   0.000000 (  0.000985)
  0.000000   0.000000   0.000000 (  0.001020)
----------------------------------------------------------------------------------------------------
Testing with n = 50000

      user     system      total        real
  0.020000   0.000000   0.020000 (  0.022009)
  0.010000   0.000000   0.010000 (  0.011092)
  0.010000   0.000000   0.010000 (  0.013515)
----------------------------------------------------------------------------------------------------
Testing with n = 500000

      user     system      total        real
  0.180000   0.010000   0.190000 (  0.190617)
  0.090000   0.010000   0.100000 (  0.099089)
  0.100000   0.020000   0.120000 (  0.115082)
----------------------------------------------------------------------------------------------------
Testing with n = 5000000

      user     system      total        real
  1.760000   0.120000   1.880000 (  1.915256)
  1.090000   0.150000   1.240000 (  1.768179)
  1.049999   0.150000   1.199999 (  1.759323)
----------------------------------------------------------------------------------------------------