Hacker News new | past | comments | ask | show | jobs | submit login

Isn't Jython not a JIT compiler, and isn't Jython much slower than cPython?



Nope and Nope. Jython is made to run on the HotSpot which is a JIT compiler, and Jython should be comparable to speed to cPython and faster in some cases (used to be slower, but that was 3-4 years ago, the optimized it a lot, and added stuff in Java 7/8 helped too).

JRuby is faster than standard C Ruby too.


There is a huge difference between an interpreter with a JIT compiler and an interpreter running on another interpreter that has one. These are not equivalent at all.


Jython is not running on an interpreter.

It IS an interpret itself, and it runs on a virtual machine that takes care of JIT compilation.


In the JRuby case, JRuby compiles Ruby to JVM bytecode.

Jython may do the same: rather than create cpython bytecode it may produce JVM bytecode which may be optimized by the JVM. However, I do not know anything about Jython performance and they could not be employing the same tactics as JRuby.

With modern Java features like lambdas coming into java 7 and 8 and other interesting languages like Scala, Groovy, etc being written for the JVM I'm sure things have come a long way since the time jython 2.4 was being developed on Java 5/6 and I'm sure the JVM has many more optimizations that dynamic languages may benefit from.


> other interesting languages like Scala, Groovy, etc being written for the JVM

I think Clojure is one of the most interesting so I'm keen you include it in your minimal list of examples. I don't think Clojure actually uses the Java 7 "invoke dynamic" bytecode though.


Jython compiles to JVM bytecode actually. That bytecode consists of a lot of calls to methods implemented in java though.


The difference between a virtual machine and an interpreter being?


Mostly orthogonal. You can have an interpreter without a virtual machine (Basic or Python doesn't have one, just a runtime), and similarly a virtual machine without an interpreter.

An interpreter executes scripting instructions directly.

A virtual machine implements a faux (virtualized) cpu, with its instruction set etc, and executes its "assembly code" (with or without JITing).

(Things get complicated in that you can also have combinations of those concepts).


Python in CPython is executed after being compiled to the lower-level Python bytecode. Is this not sufficient to consider CPython to involve a virtual machine?


Almost all interpreters compile an ast to an "assembly code" that gets executed. CPython even executes that assembly code without seeing the source at all just like Java.


Do you have a source on the benchmark results suggesting that Jython is comparable to CPython speeds?


If you run Jython on the hotspot JVM, that'd count as JIT. As for the speed, I'm not sure.


Well, it runs on the JVM, so depending on which JVM you use, it might use a JIT compiler.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: