Coro patch

Charles Oliver Nutter headius at headius.com
Tue Nov 29 23:46:42 PST 2011


Ok, good news and not as good news!

The good news is that coro seems to be working in the latest
openjdk-osx-build, and it definitely improves JRuby's coroutine
performance!

For running bench_fiber_ring with 100 fibers passing 1000 messages,
here's numbers for the threaded impl:

100 fibers / 1000 passes:   1.070000   0.000000   1.070000 (  1.071000)
100 fibers / 1000 passes:   1.070000   0.000000   1.070000 (  1.070000)
100 fibers / 1000 passes:   1.092000   0.000000   1.092000 (  1.092000)
100 fibers / 1000 passes:   1.077000   0.000000   1.077000 (  1.077000)

And with the coro impl:

100 fibers / 1000 passes:   0.215000   0.000000   0.215000 (  0.215000)
100 fibers / 1000 passes:   0.217000   0.000000   0.217000 (  0.217000)
100 fibers / 1000 passes:   0.212000   0.000000   0.212000 (  0.212000)
100 fibers / 1000 passes:   0.216000   0.000000   0.216000 (  0.215000)

Hooray!

Now for the not-as-good news...

Here's Ruby 1.9.3 on the same benchmark:

100 fibers / 1000 passes:   0.160000   0.000000   0.160000 (  0.155562)
100 fibers / 1000 passes:   0.150000   0.000000   0.150000 (  0.156581)
100 fibers / 1000 passes:   0.160000   0.000000   0.160000 (  0.155351)
100 fibers / 1000 passes:   0.150000   0.000000   0.150000 (  0.156776)

Now even getting close to 1.9.3 is really awesome, but I'm wondering
if either I'm doing something wrong (maybe broke something in the
coro-based fiber impl?) or if something regressed in coro, because
Lukas's blog post showed JRuby + coro performing significantly
*better* than C Ruby.

This is also a bit tricky to profile...since call stacks are jumping
around a bit :) A dumb sampled profile doesn't show much other than
Ruby code being hit heavily...which I'd expect.

Lukas: Are you able to reproduce these numbers with JRuby master and
bench/bench_fiber_ring.rb? Here's the command line I'm using:

jruby --1.9 -Xfiber.coroutines=true bench/bench_fiber_ring.rb 20 100 1000

- Charlie


More information about the mlvm-dev mailing list