Live data from Hacker News

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

github.com

161–170 of 184 posts

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

#161
post #93

Earlier quoted context omitted.

I have been using Python since 25 years, and never needed that one.

You never implemented a quick polish notation calculator that uses this data structure? [1,2, '+']

I would use two stacks, one of which stores numbers and the other stores operators.

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

#162

Thanks a lot for all the comments and feedback! Wanted to add a couple points/clarifications: - Codon is a completely standalone (from CPython) compiler that was started with the goal of statically compiling as much Python code as possible, particularly for scientific computing use cases. We're working on closing the gap further both in what we can statically compile, and by automatically falling back to CPython in c…

Im curious. If codon can compile a python script, why can it not compile a pure python library?

What technical limitations does an import or 3rd party add that a script wouldn't have?

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

#163

Thanks a lot for all the comments and feedback! Wanted to add a couple points/clarifications: - Codon is a completely standalone (from CPython) compiler that was started with the goal of statically compiling as much Python code as possible, particularly for scientific computing use cases. We're working on closing the gap further both in what we can statically compile, and by automatically falling back to CPython in c…

Im curious. If codon can compile a python script, why can it not compile a pure python library? What technical limitations does an import or 3rd party add that a script wouldn't have?

NumPy, PyTorch, TensorFlow and many other widely known third-party libraries are actually native code that interact with CPython directly.

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

#165

Earlier quoted context omitted.

You never implemented a quick polish notation calculator that uses this data structure? [1,2, '+']

I would use two stacks, one of which stores numbers and the other stores operators.

Why? Just to have no unions of types?

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

#166
post #91

Just out of curiosity: Why is it possible to compile Common Lisp Code (or Scheme, or Clojure) to high-performance native or jit-compiled code, but not Python? It is said that "Python is too dynamic", but is not everything in Lisp dynamic, too? And none of these languages is less powerful than Lisp, lack Unicode support, or whatever, so this can't be the reason.

It’s because Python object attributes can change any time, as they are accessed dynamically. Nothing can be inlined easily. The object structure is pointer heavy. Here is some old 2014 post: http://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/ As other commenters pointed out, some of these Python features, which are unused 99,99% time, could be sacrified for additional speedup by breaking backwards compatibil…

That common excuse doesn't fly in the face of Smalltalk, Lisp, Scheme, SELF, Prolog, JavaScript, Lua.

It is more a matter of wanting to have a JIT in the box or not.

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

#167
post #138

Earlier quoted context omitted.

I can't think of a time I ever needed to do such a thing, and I've written many thousand lines of python. Python supports OOP, so classes will get you quite far in this regard.

Wouldn't that exclude (most) nested lists?

What do you mean by nested lists? A list of lists, that's a list with a single type.

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

#169
post #124

Earlier quoted context omitted.

You've never had to read arbitrary json?

I just did a quick check (apparently DuckDuckGo has a built in JSON validation function lol love it) and `[1, "foo"]` does pass their JSON validation. Not surprised but I did want to confirm.

Am I missing something, why wouldn't a non-homogeneous array literal pass?

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

#170
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…

Python 3.11 broke a lot of stuff in Debian, as did earlier versions of Python 3:

https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=python3.9&...

Post reply on HN