Live data from Hacker News

Python-based compiler achieves orders-of-magnitude speedups

news.mit.edu

91–100 of 193 posts

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

#91
post #90
post #77

Earlier quoted context omitted.

They should have said python compiler (shorter) or python compiler in c++ (more accurate and only one character longer, including spaces). Considering at least 2 people have gone to look at the source and then come here to comment, it would have been a net benefit for all involved. Plus, what does it say about the potential quality of your compiler if you can't even make correct English statements? This seems easier…

These headlines usually work by the dept asking a researcher for a 10 sentence summary of their work. Someone in the dept summarizes that to 3 sentences, and sends that to the university pr dept. The university turns that 3 sentences into 1 and that's what's published. My take is this says more about the weird game of telephone being played than it does about the research product itself.

Yes, but it's a game of telephone that does make it annoying for HN readers to try and actually understand what's being presented, so it should be discussed and corrected if possible.

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

#92

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

Here is the TrashTalk interpreter:

import re

def trashtalk_interpreter(code): variables = {} code_lines = code.split("\n")

    for line in code_lines:
        if line.startswith("#"):
            var_name, _, value = line.partition(" like ")
            if "add " in value:
                _, var1, var2 = value.partition("add ")
                var1 = var1.strip()
                var2 = var2.strip()
                variables[var_name.strip()] = variables[var1] + variables[var2]
            else:
                variables[var_name.strip()] = int(value)
        elif line.startswith("OMG"):
            message = re.findall(r'"(.*?)"', line)
            if message:
                print(message[0].format(**variables))
# Sample code code = ''' #my_var like 10 OMG "Value of my_var: {my_var}" #var1 like 5 #var2 like 7 #sum like add #var1 #var2 OMG "Sum of {var1} and {var2} is {sum}" '''

trashtalk_interpreter(code)

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

#93
post #90

Earlier quoted context omitted.

These headlines usually work by the dept asking a researcher for a 10 sentence summary of their work. Someone in the dept summarizes that to 3 sentences, and sends that to the university pr dept. The university turns that 3 sentences into 1 and that's what's published. My take is this says more about the weird game of telephone being played than it does about the research product itself.

Yes, but it's a game of telephone that does make it annoying for HN readers to try and actually understand what's being presented, so it should be discussed and corrected if possible.

true, but if that's the case, then the game of telephone would not call (haha) into question the quality of the compiler, since the devs were not responsible for the game.

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

#94
post #25

Earlier quoted context omitted.

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

Have a look at Cinder - https://github.com/facebookincubator/cinder - it's Meta's performance oriented fork of CPython that they use to run Instagram (which is a big Django app).

I always wondered with Cinder why they didn't turbocharge PyPy development instead.

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

#95
post #51

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…

A lot of effort is dedicated to trying to improve the speed because python is so widely used that improving performance could have a massive beneficial impact. Migrating to a new language is not easy when you have millions of lines of code.

But is this still really python? This compiler and others are not a drop in replacement. They typically cover a narrow subset and/or need additional code/hints etc.

You can adopt it incrementally, but then you could just as well switch to a language with higher default performance, more language features that just work, unified tooling etc. and adopt that incrementally?

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

#96
post #77
post #74

Earlier quoted context omitted.

A fair implication, but they mean "Python-based" in that the language the compiler implements is based on Python.

They should have said python compiler (shorter) or python compiler in c++ (more accurate and only one character longer, including spaces). Considering at least 2 people have gone to look at the source and then come here to comment, it would have been a net benefit for all involved. Plus, what does it say about the potential quality of your compiler if you can't even make correct English statements? This seems easier…

1. It currently only compiles a subset of Python, which is presumably why they said it was based on Python rather than Python.

2. There are lots of good developers who aren't capable of making any statements in English.

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

#97
post #31
post #26

nit: '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

Hardly a nitpick. It's key to the claim.

It's a nit-pick because it's ultimately just a gripe about ambiguous phrasing, not because the implications of what the phrasing means are unimportant.

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

#98
post #84
post #77

Earlier quoted context omitted.

They should have said python compiler (shorter) or python compiler in c++ (more accurate and only one character longer, including spaces). Considering at least 2 people have gone to look at the source and then come here to comment, it would have been a net benefit for all involved. Plus, what does it say about the potential quality of your compiler if you can't even make correct English statements? This seems easier…

> This seems easier to get right than if( x = *p++ ) For people with native or fluent English, for sure. For the others, probably not.

What level of English fluency should we expect of professors at MIT and writers for their site?

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

#99
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?

From what I've heard Nuitka is a true compiler for actual Python (not a "Python-like" language) but does not give so much speed up

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

#100
post #53

Earlier quoted context omitted.

And it is severely underrated. Even though performance gain is aevrate around 4x-20x. Used in production and memory usage is also about 1/6th of CPython. Can get 10x perfromance easily in many cases.

> Used in production and memory usage is also about 1/6th of CPython I thought it would have higher memory usage? (based only on reading)

Somewhat paradoxically, PyPy always uses more memory for programs with small working sets, but can use less memory for programs with large working sets. 1/6 is a lot more extreme than I would have expected, though.
Post reply on HN