Live data from Hacker News

Pyjion – A Python JIT Compiler

trypyjion.com

21–30 of 126 posts

Re: Pyjion – A Python JIT Compiler

#21

Why is there so little mention of https://cython.org/ ? It's very fast, it compiles to C code, then compiles the C code with a normal compiler.

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

It usually does work on individual small functions, in my experience.

I've seen 2x improvement on string processing code (cleaning text for input to a ML model) by doing nothing other than sticking `%%cython` at the top of a notebook cell.

I don't know if this technique scales to other applications; probably not. But Cython syntactically is a superset of Python.

Re: Pyjion – A Python JIT Compiler

#22

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.

For example here's a Python project modified to work well on Cython - I think that's pretty substantially modified.

https://github.com/jameskmurphy/nes/tree/main/nes/cycore

It's more like a DSL for an FFI.

Re: Pyjion – A Python JIT Compiler

#25

Earlier quoted context omitted.

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

For example here's a Python project modified to work well on Cython - I think that's pretty substantially modified. https://github.com/jameskmurphy/nes/tree/main/nes/cycore It's more like a DSL for an FFI.

And here's a project that's mostly Python, and optionally uses Cython https://github.com/falconry/falcon

Re: Pyjion – A Python JIT Compiler

#27

Why is there so little mention of https://cython.org/ ? It's very fast, it compiles to C code, then compiles the C code with a normal compiler.

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

I mainly programmed in Cython for a few years, and never came across standard Python code it wouldn't run. It's just usually only a few times faster than Python using unmodified Python, as opposed to 50x-200x faster or more with type annotations, GIL turned off for bottleneck functions, @ decorators etc.

I loved it, being able to float between Python and C in a program, writing in Python whatever was more convenient in Python, in C whatever was more convenient in C, or anywhere in between.

"While pure Python scripts can be compiled with Cython, it usually results only in a speed gain of about 20%-50%."

https://cython.readthedocs.io/en/latest/src/tutorial/pure.ht...

Re: Pyjion – A Python JIT Compiler

#28
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.

We found the Arch Linux developer XD "All hail rolling releases, why haven't you updated yet? I published it 15 minutes ago!"

Re: Pyjion – A Python JIT Compiler

#29

Why is there so little mention of https://cython.org/ ? It's very fast, it compiles to C code, then compiles the C code with a normal compiler.

Cython is much easier to implement than people realize. A few import statements and a few types, and then you're good to go. I urge people to give it a try. The speedups can be dramatic.

Re: Pyjion – A Python JIT Compiler

#30
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.
Post reply on HN