Live data from Hacker News

Python-based compiler achieves orders-of-magnitude speedups

news.mit.edu

131–140 of 193 posts

Re: Python-based compiler achieves orders-of-magnitude speedups

#131
post #56

Paper here: "Codon: A Compiler for High-Performance Pythonic Applications and DSLs": https://dl.acm.org/doi/pdf/10.1145/3578360.3580275 "Currently, there are several Python features that Codon does not support. They mainly consist of runtime polymorphism, runtime reflection and type manipulation (e.g., dynamic method table modification, dynamic addition of class members, metaclasses, and class decorators). There are…

I'm sure this is a great project worthy of HN front page reporting but if it can't run python generally,it ain't python.

Re: Python-based compiler achieves orders-of-magnitude speedups

#132

>“Google users in America have searched for Python more often than for Kim Kardashian.” I wonder how Kim Kardashian programming language looks like. I guess low level but with garbage collector. :D

Since I have the world's greatest creative assistant handy, here's what GPT-4 thinks a Kim Kardashian language would look like: Hey dolls, let me introduce you to the Kimmie programming language, it's like totally fab and easy to use! To declare a variable, just use the hashtag symbol and the variable name, like this: #my_var To assign a value to the variable, use the word "like" followed by the value, like this: #my…

Is this an original joke/impression by GPT-4? Either way, this is hilarious.

Re: Python-based compiler achieves orders-of-magnitude speedups

#133
post #2

There are other python implementations like pypy which includes a JIT (Just In Time compiler). There are other jit which can run with official python (cpython) like numba (not all code can be optimized, but if you only need optimize your hot code path). You can use a superset language of python called cython that generate C code. It can be used to generate C bindings or fast python (for cpython) modules implemented i…

Can you use Django with those optimisations or are they good mainly for scientific computing?

Pypy is great but I didn't find it very useful with Django.

Quick, transactional HTTP exchanges (GET, POST, etc.) aren't really its thing-- there's no time for the compiler to get warmed up; the request is complete before pypy has gotten out of bed.

But if you have to do really complex view rendering (graphs or something) where it would take cpython ~10s or more to process, then pypy will leave cpython in the dust.

Re: Python-based compiler achieves orders-of-magnitude speedups

#134

Can we please not? Humanity wasted close to 50 years optimizing compilers for one garbage language. Wasted unimaginable efforts, money and developer hours... and all could've been avoided if the same people dedicated a fraction of those resources to language design. Same thing happened with Java. And now the existence of a well-developed compiler became an argument in its own right in favor of choosing a bad language…

Such an overwhelming amount of perfectly good solutions are created with Python that I have trouble conceiving it as a "trash" language. Clearly it's at least good enough in many scenarios. For example, I use it for machine learning and data science professionally and I find it much more pleasant to use than alternatives in that space (e.g. Julia and R -- both have advantages over Python but have disadvantages too).

It works, it doesn't confuse me, it's easy to find libraries and examples, and when it's too slow -- which is surprisingly rare -- I have other options to turn to. If that's trash then so be it; call me a raccoon because I'm there for the trash.

Re: Python-based compiler achieves orders-of-magnitude speedups

#135
post #126

Since this is highly incompatible with most python ecosystem right now, may I plug nuitka? https://nuitka.net/index.html It's a compiler for python code that can create stand alone executables, and up to 4 times the speed of the initial code. Best of all, it's extremely reliable, with a high level of support of event the tricky things like the scientic and gui stacks.

Seconded, I deploy large packages with gigabytes of deep learning and GIS dependencies in single executables with Nuitka and it works very well. Also handles including data files into the executable if needed.

Out of curiosity, are the GIS dependencies the proprietary ones (coughESRIcough)?

Re: Python-based compiler achieves orders-of-magnitude speedups

#136
post #126

Since this is highly incompatible with most python ecosystem right now, may I plug nuitka? https://nuitka.net/index.html It's a compiler for python code that can create stand alone executables, and up to 4 times the speed of the initial code. Best of all, it's extremely reliable, with a high level of support of event the tricky things like the scientic and gui stacks.

Seconded, I deploy large packages with gigabytes of deep learning and GIS dependencies in single executables with Nuitka and it works very well. Also handles including data files into the executable if needed.

Third'ly?... Nuitka is amazing. Simply as that.

Re: Python-based compiler achieves orders-of-magnitude speedups

#137

Python should just have optional compilation built right into the language. Likewise, modern low level languages should have syntactical conveniences and optional whitespace. It’s 2023. We don’t need to keep having this war.

I'm guessing you know, but as a reminder to readers, Python does have compilation built in. It works similarly as Java - source code is compiled to a bytecode that is then run by a virtual machine. A difference is that for executing that bytecode, CPython virtual machine have JIT native code generation.

Re: Python-based compiler achieves orders-of-magnitude speedups

#138

> Faster than the speed of C One must note that this is impossible, unless you have chosen to handicap the C-implementations while benchmarking. Borderline unethical IMO to put forth such a claim.

Pretty much every JIT-enabled language has this as at least a theoretical advantage over C.

So not impossible and therefore not unethical.

Re: Python-based compiler achieves orders-of-magnitude speedups

#139
post #126

Since this is highly incompatible with most python ecosystem right now, may I plug nuitka? https://nuitka.net/index.html It's a compiler for python code that can create stand alone executables, and up to 4 times the speed of the initial code. Best of all, it's extremely reliable, with a high level of support of event the tricky things like the scientic and gui stacks.

Seconded, I deploy large packages with gigabytes of deep learning and GIS dependencies in single executables with Nuitka and it works very well. Also handles including data files into the executable if needed.

We do similar. Works well.

Re: Python-based compiler achieves orders-of-magnitude speedups

#140

Since this is highly incompatible with most python ecosystem right now, may I plug nuitka? https://nuitka.net/index.html It's a compiler for python code that can create stand alone executables, and up to 4 times the speed of the initial code. Best of all, it's extremely reliable, with a high level of support of event the tricky things like the scientic and gui stacks.

Sold
Post reply on HN