The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
JRuby gets Gems

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christopher Cyll

Posts: 49
Nickname: topher
Registered: Jan, 2006

Topher Cyll is Rubyist and writer in Portland, Oregon.
JRuby gets Gems Posted: Jun 28, 2006 7:38 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Christopher Cyll.
Original Post: JRuby gets Gems
Feed Title: Topher Cyll
Feed URL: http://feeds.feedburner.com/cyll
Feed Description: I'm not too worried about it. Ruby and programming languages.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Christopher Cyll
Latest Posts From Topher Cyll

Advertisement
There's a great post by Charles Nutter about JRuby and Ruby Gems. He talks about two problems.

One problem (and this affects a lot of languages, not just Ruby), is that "pure" libraries have often been replaced with libraries implemented in C for performance. This is great during the dark ages, because it helps address the speed issues that almost all fledgling languages have. But as soon as these languages are targetted at new runtimes or get compilers or JITs, it becomes a problem.

For example, in the amazing Python Psyco library (a JIT for Python that delivers the kind of speed us Rubyists can only lust over), calls to "map" and "filter" are actually slower because they were implemented in C (for performance) and therefore trigger the C code <--> JIT code penalty when passed in JITed higher order functions than they would be if they were implemented in pure Python.

The Smalltalkers really got this right, and almost everything in Squeak is basically written in Smalltalk (or an easily compilable subset known as SLang). There are a few issues there, as well, but damn it's cool.

The second problem discussed is that JRuby has choosen to implement rthreads using Java native threads, which are in turn implemented with OS threads. Or at least that's my understanding. rthreads, the standard Ruby thread library is a lightweight userland implementation that accordingly can't take advantage of multiprocesser machines.

Cheap threads make certain programming strategies feasible. For example the Ruby net/http library makes use of a timing library through several layers of code. This library starts a new thread for each wait. When you are using non-lightweight native threads, this has a serious performance cost -- apparently to the point where it's unclear if the app is even making forward progress.

Just a further reminder that APIs are more than method signatures. They also include the behavior and properties of those methods and sometimes even their implementations.

Actually, it makes me a little curious why JRuby didn't implemented userland threads, ala rthreads, for the Thread module and then also provide an additional module, perhaps called NativeThread. But I'm sure there's a good reason, since JRuby consistently impresses me.

Read: JRuby gets Gems

Topic: Counting At The Cloak 'N' Bind Previous Topic   Next Topic Topic: Rubycorner.com en LinuxJournal y LaCaraOscura.com en el RailsConf 2006

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use