Live data from Hacker News

Codon: A high-performance Python-like compiler using LLVM

github.com

31–40 of 184 posts

Re: Codon: A high-performance Python-like compiler using LLVM

#31

Free for non-production use... it's a "no" for me.

I have not dug into the project yet, but if it delivers on the features it mentions it should be a game changer for a lot of companies, heavily invested in Python. Paying to use it seems fair.

numba is already a thing though

Re: Codon: A high-performance Python-like compiler using LLVM

#32
post #18

Unfortunately stuff like this never makes it to the upstream. And i am afraid to ask why. We had pypy for years, but never got merged with python. That is why there are still minor incompatibilities between pypy and "The Python", so it's not that useful as it might have been if it got merged with cpython at some point.

It's not like you can just "merge" pypy into python, they are totally different implementations. CPython is written in C and PyPy is written in RPython which is a subset of the python language that gets compiled, into into an interpreter with JIT support. You can actually write an interpreter for any language using RPython and their toolset, for example Ruby https://github.com/topazproject/topaz

Re: Codon: A high-performance Python-like compiler using LLVM

#33
post #18

Unfortunately stuff like this never makes it to the upstream. And i am afraid to ask why. We had pypy for years, but never got merged with python. That is why there are still minor incompatibilities between pypy and "The Python", so it's not that useful as it might have been if it got merged with cpython at some point.

I got a massive jump in performance when moving from Python 3.8 to 3.10 (over some function call optimizations I think, based on the project). And 3.11 got even better (up to 50% faster on special cases, and 10~15% on average) with respect to 3.10. Python 3.12 is already getting even more speedups and a there's a lot more down the road[0]. But Python core developers value keeping "not breaking anyones code" (Python 3…

same. for my work project, 3.11 was performance-equivalent to pypy 3.9

Re: Codon: A high-performance Python-like compiler using LLVM

#34
Can we change the title to say Python-like or something similar? Based on the comments so far, it seems that the detail that it compiles its own Python-inspired language, not actual Python, is lost on many.

EDIT: A list of differences here: https://docs.exaloop.io/codon/general/differences

The summary minimizes with "many Python programs will work with few if any modifications", but it actually looks like a substantially different language.

Re: Codon: A high-performance Python-like compiler using LLVM

#35
post #7

Earlier quoted context omitted.

It's also confusing... I mean, what does "non-production use" mean anyway? Does it mean "non-commercial use"? Or "testing/debug/staging environment"? Or "does not produce any valuable output"...?

It means if a company uses this program, they can't use it without paying the developer.

> It means if a company

”company” is not a particularly well-defined term.

Re: Codon: A high-performance Python-like compiler using LLVM

#36

> "...typically on par with (and sometimes better than) that of C/C++" What makes it faster than C++? I see this in the documentation but I am not sure it helps me (not an expert): > C++? Codon often generates the same code as an equivalent C or C++ program. Codon can sometimes generate better code than C/C++ compilers for a variety of reasons, such as better container implementations, the fact that Codon does not us…

JIT.

JIT can be faster than a static compiler if it takes advantage of runtime feedback, but that's not the case here:

> While Codon does offer a JIT decorator similar to Numba's, Codon is in general an ahead-of-time compiler that compiles end-to-end programs to native code.

Re: Codon: A high-performance Python-like compiler using LLVM

#37
post #25

Earlier quoted context omitted.

One of the faq things refers in passing to integers being 64bit instead of arbitrary precision. That's a bit more fundamental than some cpython modules don't work. Haven't found a language reference yet. edit: it's statically typed ahead of time - that feels like something that needs a detailed description of what it's doing, given the baseline of like-python

I wonder if the differences will cause any real compatibility issues with existing Python libraries?

It would cause major issues to libraries for mathematics (such as sympy or sagemath) that assume integers are arbitrary precision. Large integers are common in number theory and cryptography, where people also care very much about performance.

Re: Codon: A high-performance Python-like compiler using LLVM

#38
post #32
post #18

Unfortunately stuff like this never makes it to the upstream. And i am afraid to ask why. We had pypy for years, but never got merged with python. That is why there are still minor incompatibilities between pypy and "The Python", so it's not that useful as it might have been if it got merged with cpython at some point.

It's not like you can just "merge" pypy into python, they are totally different implementations. CPython is written in C and PyPy is written in RPython which is a subset of the python language that gets compiled, into into an interpreter with JIT support. You can actually write an interpreter for any language using RPython and their toolset, for example Ruby https://github.com/topazproject/topaz

Morever, a wonderful aspect of standard CPython is that you can compile it from source on a huge range of architectures in less than 5 minutes. Building Pypy from source is more difficult, and Pypy is significantly less portable (e.g., there is no viable WebAssembly version of Pypy).

Re: Codon: A high-performance Python-like compiler using LLVM

#39

Earlier quoted context omitted.

Their benchmarks ( https://exaloop.io/benchmarks ) show that Codon is much, much faster than pypy. I also just tried some microbenchmarks with their fib example (iterated many times with higher parameters) and got similar results. It's unfortunate for now that this isn't open source, but it's really valuable to demonstrate to us Python lovers what's possible using LLVM!

Their benchmarks are not to be trusted (after reading the source). - They cheat, they rewrite code to use coden specific features to "win" (ie, parallelization and GPU optimizations) - They don't warm up. They are simply running their competition directly rather than allowing any sort of warmup. (In other words, they are measuring cold boot and startup time) Now, if they want to argue about startup time or whatever m…

Thanks for doing the work to point all of this out. "Benchmarketing".

Re: Codon: A high-performance Python-like compiler using LLVM

#40
post #34

Can we change the title to say Python-like or something similar? Based on the comments so far, it seems that the detail that it compiles its own Python-inspired language, not actual Python, is lost on many. EDIT: A list of differences here: https://docs.exaloop.io/codon/general/differences The summary minimizes with "many Python programs will work with few if any modifications", but it actually looks like a substanti…

You convinced me to change the description of a "Python-like language" I'm working on to say "Python-like" instead of "Python": https://www.npmjs.com/package/pylang
Post reply on HN