What reasons would I have for not using JRuby over MRI/YARV?
In Is there an advantage to running JRuby if you don't know any Java?, people were suggesting using JRuby if you just want a better implementation of Ruby than "Ruby" (MRI/YARV).
What potential reasons would you have for not using JRuby?
Ones that have been mentioned by others are:
- Performance for short programs. JRuby is described as faster for longer programs开发者_JS百科, but having a longer initialization time. Workarounds are discussed in this question.
- C extensions: JRuby supports some, but not all, C extensions that are used with MRI/YARV.
- Concurrency as a two-edged sword. There's non-thread-safe code out there that people haven't discovered because the most popular implementation doesn't have true concurrency.
- JRuby can use more memory.
- JRuby has decided not to do certain things CRuby does. This includes continuations (which I think are deprecated in CRuby anyway), and fork. They also have a different native endian, and time precision.
- JRuby doesn't enable ObjectSpace by default.
Potential reasons I have include:
- Libraries you use may not be designed to run under JRuby. For example, BioRuby, which has 127 watchers and 60 forks on GitHub, had a minor incompatibility with JRuby.
- Fear, Uncertainty, and Doubt about using a less popular implementation. I know JRuby passes RubySpec better than CRuby, but RubySpec is not yet complete.
Are there any other reasons you wouldn't use JRuby?
Personally, while it comes pre-installed on Macs I don't always install Java on my Linux machines.
As an aside, RVM should probably be mentioned here as the canonical way to juggle multiple (8 or more?!) different Ruby interpreters.
JRuby doesn't seem to give $SAFE a high priority. The blog post is from 2007, but I haven't come across any changes since then.
精彩评论