Python-based compiler achieves orders-of-magnitude speedups
111–120 of 193 posts
Re: Python-based compiler achieves orders-of-magnitude speedups
#112Can 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…
yet its the language of choice for several people who are domain experts but not programming experts. It's doing a job for non-programmers who have to program. until a solution exists that does better, python is going nowhere.
Fast food is universally more popular than any healthy food that requires time to cook.
People choose to buy low-quality goods in general, trading quality for immediate effect all the time. Take any industry, any product kind, you will see that consumption is skewed towards paying extra for immediate gain rather than paying for quality to minimize waste over time.
The fact that you chose to rely on the opinion of non-experts in the field to assess the value / quality of a particular technology only means that you don't understand what quality is about. You are confused between wants and needs.
Re: Python-based compiler achieves orders-of-magnitude speedups
#113Paper 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 wonder what experienced Common Lisp compiler devs could accomplish if they turned their attention to Python.
Re: Python-based compiler achieves orders-of-magnitude speedups
#114Paper 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 wonder what experienced Common Lisp compiler devs could accomplish if they turned their attention to Python.
Re: Python-based compiler achieves orders-of-magnitude speedups
#115Python 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.
Re: Python-based compiler achieves orders-of-magnitude speedups
#116nit: 'Python-based' would imply to me that it's written in Python, but it looks like it's mostly C++ & LLVM: https://github.com/exaloop/codon/tree/develop/codon
Github reports it's 55% C++ and 43% Python, not too bad if it's correct.
Re: Python-based compiler achieves orders-of-magnitude speedups
#117Am losing count of all these efforts to rescue Python's performance - they all seem to amount to the same thing: it's not very hard to achieve this if you throw out fundamental aspects that make Python what it is. The premise is always that syntax is the barrier, and that people struggle so much to learn a new syntax that this is what keeps them using Python even though its performance is abysmal. But what if this is…
Python does not need to be rescued. Its fast enough. For 90% of applications, you are kidding yourself if you need more speed.
These are enhancements on Python, where you want to run stuff even faster on par with other languages.
Re: Python-based compiler achieves orders-of-magnitude speedups
#118There 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…
One great move I've discovered recently is to simply type annotate the python thoroughly and use mypyc to build a c package
Re: Python-based compiler achieves orders-of-magnitude speedups
#119Preface: 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…
Wow, what a way to mischaracterize what Guido said.
His point was about languages evolving to be more abstract than Python or any of the ones you mentioned. Programming is going to become more and more abstract to the point where you will be able to program in natural language through speech. In the mean time, we still have to write code manually.
And look, there are plenty of valid criticisms of Python, but you are kidding yourself if you don't think its going to be one of the primary languages of the future. There is a reason why it has the 2nd most gihub repos (behind JS, because of hard dependency on it for web stuff).
And the simple reason is this: the vast, vast majority of applications don't need the fastest possible speed, its much more important to be able to develop fast, and have it be right. Its easier and cheaper to throw another EC2 instance in your stack rather than pay a developer to write stuff from scratch whereas in Python you can just import the relevant library for your needs and be up and running much faster, not only the short concise syntax used, but also the introspection into the running language because of its interpreted nature. And this allowed the snowball effect to happen, where developers could quickly write relevant libraries, which in turn allowed other developers to quickly import those libraries and write their libraries, slingshotting Python into a language that is used not only for bleeding edge ML stuff but to run backend web stacks with no issues.
And in the cases where you do need speed, this is where these compilers come in, and its a 100% valid use of manpower and money. Think of it as another library.
Every other language that focuses on things like static typing, whatever type of inheritance the designers think is best, memory safety, and all the other theoretical CS stuff completely misses the above point, and for that reason alone, it will never become mainstream. Rust is not going to happen, Nim is not going to happen, Julia is not going to happen, Scala is not going to happen, Elixir is not going to happen. Sure, there will be a significant amount of code written in those, but the popularity will never come close to Pythons. You may not like it, but you know this is true.
We have already seen this cycle happen with Haskell where functional programming was the next best thing. you would constantly see posts about it at the same frequency you now see posts about Rust, and look where Haskell is now.
Re: Python-based compiler achieves orders-of-magnitude speedups
#120Earlier quoted context omitted.
Ye well if you remove the dynamic feutures of a dynamic language it gets fast. It would be really impressive of they can achieve those feutures with the sameish speed.
I dont necessarily need all that dynamism though, and would happily use a Python subset that removed some stuff (and forced type hinting) in exchange for better compilation. Yes there are already subsets like this, but its not as helpful if it isnt standard.
If you code a website, fast api and django, the two most popular framework to do so, heavily rely on them to make you productive.