Live data from Hacker News

Pyjion – A Python JIT Compiler

trypyjion.com

31–40 of 126 posts

Re: Pyjion – A Python JIT Compiler

#31

Earlier quoted context omitted.

My understanding is that Cython does not run unmodified standard Python code.

It can run most unmodified Python code, but it needs types for the big speedups.

That's misleading as normal type annotations don't give you any performance benefit at all and you may need to do a lot more than just add type annotations.

I think it's far more accurate to say that Cython is a programming language of its own that is a hybrid of Python and C++, that happens to produce CPython extension modules when compiled.

The performance benefits are really achieved by incrementally changing your Python code to something that looks a lot more like C(++).

This is also reflected in the Cython documentation which literally mentions the "Cython language".

Cython is great as an alternative to writing C extension modules for performance reasons or to creating bindings to libraries written in C or C++. It's not so great just to make Python applications faster as it's not fully compatible[1].

[1]: https://cython.readthedocs.io/en/latest/src/userguide/limita...

Re: Pyjion – A Python JIT Compiler

#32
post #4

This is the first time I've learned of this. How it compares to PyPy [1]: > PyPy is an implementation of Python with its own JIT. The biggest difference compared to Pyjion is that PyPy doesn't support all C extension modules without modification unless they use CFFI or work with the select subset of CPython's C API that PyPy does support. Pyjion also aims to support many JIT compilers while PyPy only supports their c…

Isn't this what the GraalVM [1] guys are also trying to do? Seems like today the competition is between who is more polyglot than the other, JVM, CLR or WASM. [1] https://github.com/oracle/graalpython

WASM isn't on the same league until it offers GC support.

Re: Pyjion – A Python JIT Compiler

#33
post #19

Pyjion requires: CPython 3.10 and .NET 6 .NET 6 Release: 19 hours ago ( https://github.com/dotnet/core/blob/main/release-notes/6.0/6... ) ... ok.

.NET 6 has been in prerelease for a while, and it's the next LTS release. Makes sense that it would be used as soon as it was available. Upgrading from 5 to 6 should be pretty trivial.

I've tried it on Fedora:

https://docs.microsoft.com/en-us/dotnet/core/install/linux-f...

> The latest version of .NET that's available in the default package repositories for Fedora is .NET 5. Installing .NET 6 through the default package repositories is coming soon. For now, you'll need to install .NET 6 in one of the following ways:

> Install the .NET SDK or the .NET Runtime with Snap.

> Install the .NET SDK or the .NET Runtime with a script.

> Install the .NET SDK or the .NET Runtime manually.

Nope, thank you

Re: Pyjion – A Python JIT Compiler

#34

Earlier quoted context omitted.

Isn't this what the GraalVM [1] guys are also trying to do? Seems like today the competition is between who is more polyglot than the other, JVM, CLR or WASM. [1] https://github.com/oracle/graalpython

A big difference is the Pyjion generates .NET compiler IR manually, while GraalVM generates Graal compiler IR automatically through partial evaluation of a declarative specification of an interpreter specialised to the program (the first Futamura Projection.) In my opinion that's far more powerful in terms of removing abstraction. But Pyjion also seems like a very cool project.

Damn I didn't know any of the Futamura Projections where actually implemented in practice.

Re: Pyjion – A Python JIT Compiler

#35

Earlier quoted context omitted.

A big difference is the Pyjion generates .NET compiler IR manually, while GraalVM generates Graal compiler IR automatically through partial evaluation of a declarative specification of an interpreter specialised to the program (the first Futamura Projection.) In my opinion that's far more powerful in terms of removing abstraction. But Pyjion also seems like a very cool project.

Damn I didn't know any of the Futamura Projections where actually implemented in practice.

https://chrisseaton.com/truffleruby/pldi17-truffle/pldi17-tr...

Re: Pyjion – A Python JIT Compiler

#36
post #19

Pyjion requires: CPython 3.10 and .NET 6 .NET 6 Release: 19 hours ago ( https://github.com/dotnet/core/blob/main/release-notes/6.0/6... ) ... ok.

Well, if one wants stability and production releases, why would they be trying a new, experimental, JIT compiler for Python?

Re: Pyjion – A Python JIT Compiler

#37
post #36
post #19

Pyjion requires: CPython 3.10 and .NET 6 .NET 6 Release: 19 hours ago ( https://github.com/dotnet/core/blob/main/release-notes/6.0/6... ) ... ok.

Well, if one wants stability and production releases, why would they be trying a new, experimental, JIT compiler for Python?

If it just required doing "pip install" then I'd try it to see how fast my test suite runs. But since it only works with Python 3.10 and .NET 6, realistically even just spending five minutes messing with it will require first waiting 18 months or whatever.

Re: Pyjion – A Python JIT Compiler

#38
post #16

The overall speed-up factor (calculated from the numbers in the Benchmarks diagram, geomean of factors) is 1.6, which is much less than the factor 4 achieved with PyPy (or the even higher factor claimed by Graal Python). CLI is not very well suited for dynamic languages; as far as I remember the results presented here correspond with Iron Python, which is to be expected based on the proposed concept. EDIT: Yes, indee…

Assuming zero compatibility problems and a simple drop in, I say 1.6 is pretty damn good from the start.

Ruby' drop in YJIT barely managed ~20% speed up.

Re: Pyjion – A Python JIT Compiler

#39
post #36

Earlier quoted context omitted.

Well, if one wants stability and production releases, why would they be trying a new, experimental, JIT compiler for Python?

If it just required doing "pip install" then I'd try it to see how fast my test suite runs. But since it only works with Python 3.10 and .NET 6, realistically even just spending five minutes messing with it will require first waiting 18 months or whatever.

Seems like it would take no more than 5 minutes to download and untar the listed dependencies, though. I don’t understand this attitude about experimentation.

Re: Pyjion – A Python JIT Compiler

#40
post #9
post #5

So this is basically a newer, cooler IronPython?

From FAQ[1]: > IronPython is an implementation of Python that is implemented using .NET. While IronPython tries to be usable from within .NET, Pyjion does not have a compatibility story with .NET. This also means IronPython cannot use C extension modules while Pyjion can. [1] https://github.com/tonybaloney/pyjion#ironpython

So it basically uses .NET in place of something like, LLVM, in order to generate native code. Clever.
Post reply on HN