Ruby Threads and the Global Interpreter Lock in C
omniref.com
omniref.com
Slightly of topic, but can anyone with better knowledge then myself of ruby implementations and internals explain why it hasn't caught much of a following (what it seems anyway, I may be wrong here).
To me it seems like a pretty good idea to implement Ruby mostly in Ruby, since it makes it easier to get contributions (especially to less performance-sensitive parts of the language, e.g. parts of the standard lib).
https://github.com/ruby/ruby/tree/trunk/lib
Rubinius' one (called RubySL) also includes some rewrites of standard libraries, that were originally written in C. And as you may know, Rubinius itself is just Ruby code to some extent.
mruby has some Ruby code, too. Even some parts of the core language are written in it.
Also, people that do want to work at the core of a language usually have knowledge of multiple and don't mind using C or any other implementation language.
Ruby stdlib is mostly written in Ruby, btw.
Still, with Rubinius 3.0 coming up, I'm very interested what is coming there.
it appeared almost automatically after I moved my mouse to close the tab... Are they doing some mouse tracking and looking for rapid movement off screen (to the top of the page)?
If so, that's really cool. If not, nevermind
Glad I wasn't crazy
Disclaimer: it's linked in the omniref.com page too.
Though in the case of CPython most of the cost comes from the refcounting. MRI is not refcounted so the performance hit of finer locking would probably be lower.
[0] http://dabeaz.blogspot.be/2011/08/inside-look-at-gil-removal...
There's also the fact that because of slow startup times, the modify/test cycle can be quite frustrating compared to working with MRI.
The truth is that the vast majority of ruby applications never reach a point where the steady-state post-warmup performance of jruby with pure ruby outweighs the fast-startup moderate performance of mri+cexts. And ones that do reach that point often have a better case for moving to something else anyways (including other jvm technologies that can now be shimmed on via jruby and eventually replace the whole thing).
Jruby + truffle + cext, however is becoming a possibility.
I haven't looked deeply, but this seems like something where the edge cases will be tricky, though.
What you + the jruby team is doing is truly awesome, at some point I'll have to try my hand at contributing to it :)
Memory usage and startup time are comparable to MRI - http://www.oracle.com/technetwork/java/jvmls2013wimmer-20140... see slide 19.
If you want to contribute there are beginner bugs (admittedly you need to be a fairly confident beginner) at https://github.com/jruby/jruby/issues?q=is%3Aopen+is%3Aissue....
"My vague plan for Ruby GIL is 1) add more abstract concurrency e.g. actors 2) add warning when using threads directly 3) then remove GIL"