JRuby with coroutines
Charles Oliver Nutter
headius at headius.com
Tue Apr 6 12:18:31 PDT 2010
Ok, I've had a chance to look your post over. Really awesome work!
I've had it on my to-do list for weeks to get your stuff wired in, but
never got around to it.
So yeah, this is great and I'm ready to merge in changes *right now*
:) Obviously you had to change things in JRuby, so we'd probably want
to have a CoroutineFiberLibrary that we can reflectively load when
coroutines are available, using the threaded version otherwise.
There's also another form of fibers for Ruby 1.8 mode that's currently
implemented mostly in Ruby called Generator, which works basically the
same way (plus some creative finalization to allow generator threads
to die when references to them die...it's not pretty). If we could get
your FiberLibrary changes I can take it from there.
It sounds like you also needed some changes in your stuff, like adding
CoroutineLocals (which I totally punted on in the threaded Fiber), and
maybe there's other bits and bobs. I'll look forward to seeing that
merged into the patchset.
In my opinion this proves that the coroutine work is worth trying to
get into JDK7, even at this late stage. I'd even say it makes it
worthwhile to run a hand-build JDK7 + coroutines if you have a use
case that needs thousands of threadlets.
Really awesome stuff. I'm standing by on IRC (freenode, "headius",
#jruby) or IM ("headius" or "headiusmaximus" on the usual services) or
email to work with you on this. I'm very excited!
On Tue, Apr 6, 2010 at 11:16 AM, Lukas Stadler <lukas.stadler at jku.at> wrote:
> Today I toyed around a little bit with JRuby and coroutines.
> I modified JRuby to use my coroutine implementation and ran some
> fiber-microbenchmarks. The results are pretty good:
> I know that the gains won't be nearly as big in real-world applications,
> but it surely won't hurt...
> - Lukas
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
More information about the mlvm-dev