Skip to content

Instantly share code, notes, and snippets.

@headius headius/gist:1408381
Created Nov 30, 2011

Embed
What would you like to do?
JRuby Fiber perf compared to 1.9.3
# Ruby 1.9.3
ruby-1.9.3-p0 ~/projects/jruby $ ruby -v bench/bench_fiber_ring.rb 5 100 1000
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
bench/bench_fiber_ring.rb:23: warning: mismatched indentations at 'end' with 'def' at 21
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.155022)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153985)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153822)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.152370)
100 fibers / 1000 passes: 0.160000 0.000000 0.160000 ( 0.155857)
# JRuby default, using threads for fibers
ruby-1.9.3-p0 ~/projects/jruby $ jruby --1.9 bench/bench_fiber_ring.rb 10 100 1000
100 fibers / 1000 passes: 1.871000 0.000000 1.871000 ( 1.871000)
100 fibers / 1000 passes: 1.495000 0.000000 1.495000 ( 1.495000)
100 fibers / 1000 passes: 1.278000 0.000000 1.278000 ( 1.278000)
100 fibers / 1000 passes: 1.257000 0.000000 1.257000 ( 1.257000)
100 fibers / 1000 passes: 1.291000 0.000000 1.291000 ( 1.291000)
100 fibers / 1000 passes: 1.102000 0.000000 1.102000 ( 1.103000)
100 fibers / 1000 passes: 1.098000 0.000000 1.098000 ( 1.099000)
100 fibers / 1000 passes: 1.139000 0.000000 1.139000 ( 1.139000)
100 fibers / 1000 passes: 1.180000 0.000000 1.180000 ( 1.180000)
100 fibers / 1000 passes: 1.097000 0.000000 1.097000 ( 1.097000)
# JRuby on OpenJDK with coroutine support
ruby-1.9.3-p0 ~/projects/jruby $ jruby --1.9 -Xfiber.coroutines=true bench/bench_fiber_ring.rb 10 100 1000100 fibers / 1000 passes: 0.821000 0.000000 0.821000 ( 0.820000)
100 fibers / 1000 passes: 0.582000 0.000000 0.582000 ( 0.582000)
100 fibers / 1000 passes: 0.355000 0.000000 0.355000 ( 0.354000)
100 fibers / 1000 passes: 0.292000 0.000000 0.292000 ( 0.292000)
100 fibers / 1000 passes: 0.307000 0.000000 0.307000 ( 0.307000)
100 fibers / 1000 passes: 0.260000 0.000000 0.260000 ( 0.260000)
100 fibers / 1000 passes: 0.223000 0.000000 0.223000 ( 0.223000)
100 fibers / 1000 passes: 0.246000 0.000000 0.246000 ( 0.246000)
100 fibers / 1000 passes: 0.226000 0.000000 0.226000 ( 0.226000)
100 fibers / 1000 passes: 0.222000 0.000000 0.222000 ( 0.222000)
# JRuby on OpenJDK with coroutine support, invokedynamic disabled
ruby-1.9.3-p0 ~/projects/jruby $ jruby --1.9 -Xcompile.invokedynamic=false -Xfiber.coroutines=true bench/bench_fiber_ring.rb 10 100 1000
100 fibers / 1000 passes: 0.298000 0.000000 0.298000 ( 0.299000)
100 fibers / 1000 passes: 0.114000 0.000000 0.114000 ( 0.114000)
100 fibers / 1000 passes: 0.095000 0.000000 0.095000 ( 0.095000)
100 fibers / 1000 passes: 0.099000 0.000000 0.099000 ( 0.099000)
100 fibers / 1000 passes: 0.102000 0.000000 0.102000 ( 0.102000)
100 fibers / 1000 passes: 0.085000 0.000000 0.085000 ( 0.085000)
100 fibers / 1000 passes: 0.091000 0.000000 0.091000 ( 0.091000)
100 fibers / 1000 passes: 0.113000 0.000000 0.113000 ( 0.113000)
100 fibers / 1000 passes: 0.084000 0.000000 0.084000 ( 0.084000)
100 fibers / 1000 passes: 0.080000 0.000000 0.080000 ( 0.080000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.