views:

806

answers:

5
+1  Q: 

Jython or JRuby?

It's a high level conceptual question. I have two separate code bases that serve the same purpose, one built in Python and the other in Ruby. I need to develop something that will run on JVM. So I have two choices: convert the Python code to Jython or convert the Ruby to JRuby. Since I don't know any of them, I was wondering if anyone can give me some guidance. Like which one runs faster, or more importantly which one has tools available for easy code migration(.pyc to .jar files)?

+5  A: 
Hank Gay
+1  A: 

The compatibility in either case is at the source-code level; with necessary changes where the Python or Ruby code invokes packages that involve native code (especially, standard Python packages like ctypes are not present in Jython).

Steve Gilham
+2  A: 

If you are going to be investing time and effort into either platform you should check how active the development is on both platforms. Subscribe to the mailing lists and newsgroups to get an idea of the community, check the source control system for both projects and get a feeling for how active the development is.

I am more familiar with Python than Ruby. The Jython project after a period slow movement has really picked up momentum, a Python 2.5 compatible version was released in June. This is a major step forward as Python 2.5 introduces some very useful language enhancements: http://docs.python.org/whatsnew/2.5.html

Tendayi Mawushe
+1  A: 

Performance may be the deciding factor: in this benchmark (which, like all benchmarks, should be taken with a grain of salt), JRuby ran somewaht faster than native Ruby, while Jython was outperformed by CPython by a factor of 3.

Michael Borgwardt
That comparison is pretty meaningless. More relevant would be a comparison between JRuby and Jython. Extrapolating from the Great Language Shootout and the numbers you provide, Jython and JRuby should be very competitive with one another.
Hank Gay
The numbers in the benchmark I cited indicate that JRuby outperforms Jython by a factor of 8.
Michael Borgwardt
That should have been the comparison in your answer. There should have been a paragraph break between the shootout reference and everything that came before it. I referenced it because I think it provides a more informative picture than a single benchmark, but it doesn't provide Jython numbers. Unfortunately, I don't know of any good benchmarking for the latest Jython release.
Hank Gay
A: 

Anything you can do in one, you can do in the other.

Learn enough of both to realise which one appeals to your coding sensibilities. There is no right or wrong answer here.

Rob