Live data from Hacker News

Python-based compiler achieves orders-of-magnitude speedups

news.mit.edu

41–50 of 193 posts

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

#41

>“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

Kardashians are famous for... being famous.

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

#42
post #3

So the differences: https://docs.exaloop.io/codon/general/differences So more limited types (integers) and more type checking and collections have to have one kind of thing in them. There are other python compilers though, like https://github.com/Nuitka/Nuitka I wonder really what the advantages/disadvantages of these are?

"While Codon's syntax and semantics are virtually identical to Python's, [...] Codon currently uses ASCII strings unlike Python's unicode strings."

So aside from that tiny issue at the center of the decade-long Python 2 to 3 migration debacle, it's virtually identical!

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

#43

>“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

It wouldn't waste time garbage collecting to focus on trash talking instead.

Introducing "Trashtalk" a Smalltalk dialect without GC!

This language isn't here to make friends.

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

#44
post #40

Quite sad to know that the dynamic nature of Python is preventing the speedups in the first place. I really hope there'll be a built-in optimizing JIT compiler without the limitations of PyPy, Codon, Nuitka, Numba, etc.

JavaScript/lua are dynamic and they are fast. It's other choices (GIL) which cause problem rather than the nature of the dynamic language space

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

#46

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…

What is a non-trash programming language?

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

#48
Preface: I don't just want to crap on Python here and sell Nim. I like Python, and still use it.

But it still shocks me just how much money and manpower is thrown at trying to bikeshed and optimize and compile Python and its libraries, while the Nim compiler is essentially a community hobby project that has made the concept of a "compiled Python" a reality already. The orders of magnitude in scale difference, and the qualities of the output products, are staggering.

I'm kind of starting to see what Guido is talking about when he says Python is a legacy language that's probably on its way out. Even in the interpreted world, languages like Janet and other newcomers are performing fascinating experiments, often doing more with less.

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

#49
post #23

Earlier quoted context omitted.

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

You can certainly use it, but whether you see any benefit is going to strongly depend on your workload. If you're doing significant calculations in the API then it might be considerably more performant, but if your API is primarily retrieving things from the database and transforming it to JSON then you're going to be limited mostly by the database latency and so I wouldn't expect major improvements.

If you are fetching lots (not even 'big data', but a few thousand rows) of data using the Django ORM, you will see a performance difference when using pypy, or at least I did a few years ago. The database can happily return a few thousand rows very quickly, especially if you take care to optimize your queries and have good indexes.

Converting a few thousand rows to python/django objects takes _time_. I can't quantify anything, because it's been too long, but I remember it being fairly significant. When I profiled it, the majority of the time was spent calling __setattr__ a few million times.

Like you said, it depends on your use case. If your queries are slow, then optimize your database queries. But if your queries are fast and your responses are still slow, then investigating pypy is definitely worth it. You can also play around with .values_list or something in Django, so that you get 'raw values' instead of objects (but there's still a cost to building them up).

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

#50

>“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

> I wonder how Kim Kardashian programming language looks like. I guess low level but with garbage collector. :D

And exposed naked primitives ... :-)

Post reply on HN