Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created August 22, 2009 18:30
Show Gist options
  • Select an option

  • Save methodmissing/172906 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/172906 to your computer and use it in GitHub Desktop.
methodmissing:callback lourens$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.5.1]
methodmissing:callback lourens$ rake bench
(in /Users/lourens/projects/callback)
/opt/local/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.5.1 -I/opt/local/lib/ruby/1.8/i686-darwin9.5.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -pipe -fno-common -c callback.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o callback.bundle callback.o -L. -L/opt/local/lib -L. -ldl -lobjc
/opt/local/bin/ruby bench/bench.rb
Rehearsal ---------------------------------------------------------------------------------
Callback{ 'hai' }.call 0.030000 0.000000 0.030000 ( 0.033703)
RubyCallback{ 'hai' }.call 0.070000 0.000000 0.070000 ( 0.075218)
Callback( 'bai', :to_s ).call 0.010000 0.000000 0.010000 ( 0.011626)
RubyCallback( 'bai', :to_s ).call 0.030000 0.000000 0.030000 ( 0.046987)
Callback( 'bai', :gsub ).call( 'b', 'h' ) 0.030000 0.000000 0.030000 ( 0.030269)
RubyCallback( 'bai', :gsub ).call( 'b', 'h' ) 0.070000 0.000000 0.070000 ( 0.074549)
------------------------------------------------------------------------ total: 0.240000sec
user system total real
Callback{ 'hai' }.call 0.030000 0.000000 0.030000 ( 0.052946)
RubyCallback{ 'hai' }.call 0.060000 0.000000 0.060000 ( 0.066984)
Callback( 'bai', :to_s ).call 0.020000 0.000000 0.020000 ( 0.011566)
RubyCallback( 'bai', :to_s ).call 0.030000 0.000000 0.030000 ( 0.042617)
Callback( 'bai', :gsub ).call( 'b', 'h' ) 0.030000 0.000000 0.030000 ( 0.031233)
RubyCallback( 'bai', :gsub ).call( 'b', 'h' ) 0.060000 0.000000 0.060000 ( 0.073979)
/opt/local/bin/ruby bench/raggi_bench.rb
# Calling
Rehearsal ---------------------------------------------
methback: 0.040000 0.000000 0.040000 ( 0.039738)
lambdabk: 0.080000 0.000000 0.080000 ( 0.090898)
callback: 0.120000 0.000000 0.120000 ( 0.131832)
callbak2: 0.050000 0.000000 0.050000 ( 0.059617)
rubyback: 0.200000 0.000000 0.200000 ( 0.220093)
farm: 0.050000 0.000000 0.050000 ( 0.065850)
------------------------------------ total: 0.540000sec
user system total real
methback: 0.040000 0.000000 0.040000 ( 0.044332)
lambdabk: 0.080000 0.000000 0.080000 ( 0.093244)
callback: 0.120000 0.000000 0.120000 ( 0.131888)
callbak2: 0.060000 0.000000 0.060000 ( 0.062446)
rubyback: 0.200000 0.000000 0.200000 ( 0.217808)
farm: 0.060000 0.000000 0.060000 ( 0.063897)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment