7 ms·
Isn't Jython not a JIT compiler, and isn't Jython much slower than cPython?
by mangeletti 11y ago
Isn't Jython not a JIT compiler, and isn't Jython much slower than cPython?
- makmanalp 11y agoIf you run Jython on the hotspot JVM, that'd count as JIT. As for the speed, I'm not sure.
- coldtea 11y agoNope 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.
- DasIch 11y agoThere 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.
- coldtea 11y agoJython is not running on an interpreter. It IS an interpret itself, and it runs on a virtual machine that takes care of JIT compilation.
- DasIch 11y agoThe difference between a virtual machine and an interpreter being?
- coldtea 11y agoMostly 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).
- ihm 11y agoPython 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?
- DasIch 11y agoAlmost 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.
- paulfurtado 11y agoIn 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.
- vorg 11y ago> 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.
- ehaliewicz2 11y agoJython compiles to JVM bytecode actually. That bytecode consists of a lot of calls to methods implemented in java though.
- fnord123 11y agoDo you have a source on the benchmark results suggesting that Jython is comparable to CPython speeds?
- wtetzner 11y agoWell, it runs on the JVM, so depending on which JVM you use, it might use a JIT compiler.