Skip to content

Instantly share code, notes, and snippets.

@ferrous26
Created March 10, 2012 08:12
Show Gist options
  • Select an option

  • Save ferrous26/2010801 to your computer and use it in GitHub Desktop.

Select an option

Save ferrous26/2010801 to your computer and use it in GitHub Desktop.
For MacRuby pull request #60
require 'benchmark'
Benchmark.bmbm do |bench|
url = NSURL.URLWithString('http://macruby.org/')
set = NSSet.setWithArray([1,2,3])
bundle = NSBundle.mainBundle
freq = 100_000
bench.report('url#inspect') do |x|
freq.times do
url.inspect
end
end
bench.report('set#inspect') do |x|
freq.times do
set.inspect
end
end
bench.report('bundle#inspect') do |x|
freq.times do
bundle.inspect
end
end
end
@ferrous26
Copy link
Copy Markdown
Author

At commit 6d361274a

Rehearsal --------------------------------------------------
url#inspect      0.180000   0.000000   0.180000 (  0.183879)
set#inspect      1.140000   0.020000   1.160000 (  1.023663)
bundle#inspect   1.010000   0.030000   1.040000 (  0.870070)
----------------------------------------- total: 2.380000sec

                     user     system      total        real
url#inspect      0.200000   0.010000   0.210000 (  0.196978)
set#inspect      1.230000   0.030000   1.260000 (  1.064581)
bundle#inspect   1.090000   0.050000   1.140000 (  0.901761)

@ferrous26
Copy link
Copy Markdown
Author

At commit 23566d2d1d1e

Rehearsal --------------------------------------------------
url#inspect      0.190000   0.010000   0.200000 (  0.184011)
set#inspect      1.090000   0.020000   1.110000 (  0.981232)
bundle#inspect   0.970000   0.020000   0.990000 (  0.837169)
----------------------------------------- total: 2.300000sec

                     user     system      total        real
url#inspect      0.230000   0.020000   0.250000 (  0.207397)
set#inspect      1.130000   0.020000   1.150000 (  0.971568)
bundle#inspect   1.090000   0.050000   1.140000 (  0.892173)

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