Live data from Hacker News

A high-performance, zero-overhead, extensible Python compiler using LLVM

github.com

11–20 of 95 posts

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#11
post #6

What’s the difference between this and Cython? I think another comment already asks about shedskin.

Cython relies heavily on the Python runtime. You cannot, for example, make a standalone binary with it. A lot of unoptimized Cython binary is just Python wrapped in C.

From a quick glance this seems to genuinely translate into native execution.

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#12
Unclear if this has been in the works longer as the graalvm LLVM build of python discussed yesterday[1]. The first HN discussion is from 2022 [3].

Any relation? Any comparisons?

Funny I can't find the license for graalvm python in their docs [2]. That could be a differentiator.

- [1] GraalVM Python on HN https://news.ycombinator.com/item?id=41570708

- [2] GraalVM Python site https://www.graalvm.org/python/

- [3] HN Dec 2022 https://news.ycombinator.com/item?id=33908576

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#13
post #12

Unclear if this has been in the works longer as the graalvm LLVM build of python discussed yesterday[1]. The first HN discussion is from 2022 [3]. Any relation? Any comparisons? Funny I can't find the license for graalvm python in their docs [2]. That could be a differentiator. - [1] GraalVM Python on HN https://news.ycombinator.com/item?id=41570708 - [2] GraalVM Python site https://www.graalvm.org/python/ - [3] HN D…

GraalPy license on GitHub - https://github.com/oracle/graalpython/blob/master/LICENSE.tx...

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#15

What's up with their benchmarks[1], it just shows benchmark names and I don't see any numbers or graphs. Tried Safari and Chrome. [1]: https://exaloop.io/benchmarks/

The benchmark page looks to be broken, the JS console is showing some 404'd JS libs and a bad function call.

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#16
Reminds me of these two projects which were presented at EuroPython 2024 this summer:

https://ep2024.europython.eu/session/spy-static-python-lang-...

https://ep2024.europython.eu/session/how-to-build-a-python-t...

(The talks were fantastic but they have yet to upload the recordings to YouTube.)

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#17
post #6

What’s the difference between this and Cython? I think another comment already asks about shedskin.

Cython relies heavily on the Python runtime. You cannot, for example, make a standalone binary with it. A lot of unoptimized Cython binary is just Python wrapped in C. From a quick glance this seems to genuinely translate into native execution.

You absolutely can create a standalone binary with Cython: see the `--embed` option [1].

[1] https://cython.readthedocs.io/en/stable/src/tutorial/embeddi...

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#18
> Non-goals: Drop-in replacement for CPython: Codon is not a drop-in replacement for CPython. There are some aspects of Python that are not suitable for static compilation — we don't support these in Codon.

This is targeting a Python subset, not Python itself.

For example, something as simple as this will not compile, because lists cannot mix types in Codon (https://docs.exaloop.io/codon/language/collections#strong-ty...):

    l = [1, 's']
It's confusing to call this a "Python compiler" when the constraints it imposes pretty fundamentally change the nature of the language.

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#19

> Non-goals: Drop-in replacement for CPython: Codon is not a drop-in replacement for CPython. There are some aspects of Python that are not suitable for static compilation — we don't support these in Codon. This is targeting a Python subset, not Python itself. For example, something as simple as this will not compile, because lists cannot mix types in Codon ( https://docs.exaloop.io/codon/language/collections#strong-…

Yeah, it feels closer to something like Cython without the python part.

Re: A high-performance, zero-overhead, extensible Python compiler using LLVM

#20

> Non-goals: Drop-in replacement for CPython: Codon is not a drop-in replacement for CPython. There are some aspects of Python that are not suitable for static compilation — we don't support these in Codon. This is targeting a Python subset, not Python itself. For example, something as simple as this will not compile, because lists cannot mix types in Codon ( https://docs.exaloop.io/codon/language/collections#strong-…

It's not even a subset. They break foundational contracts of the Python language without technical necessity. For example,

> Dictionaries: Codon's dictionary type does not preserve insertion order, unlike Python's as of 3.6.

That's a gratuitous break. Nothing about preserving insertion order interferes with compilation, AOT or otherwise. The authors of Codon broke dict ordering because they felt like it, not because they had to.

At least Mojo merely claims to be Python-like. Unlike Codon, it doesn't claim to be Python then note in the fine print that it doesn't uphold Python contractual language semantics.

Post reply on HN