How to make Python run as fast (or faster) than Julia

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Feb 26 08:03:34 EST 2018


On Mon, 26 Feb 2018 22:34:00 +1100, Chris Angelico wrote:

[...]
>> (We tried painting Go Faster stripes on the server, and it didn't
>> work.)
> 
> Steven Middlename D'Aprano! You should know better than that. "It didn't
> work" is not good enough. What actually happened?

A truck crashed into the power pole outside our building and the power 
went off. Then the UPS ran down and the server crashed.

Clearly this is a bug in the go-faster stripes. We tried reporting it:

    Expected behaviour: server goes faster.

    Actual behaviour: a truck crashes into the power pole 
    across the street and the lights go out.

but the maintainers closed the issue "Works for me". Very disappointed!


[...]
> Removing the GIL from CPython is not about "speeding up" the language or
> the interpreter, but about improving parallelism.

It is about speeding up threaded code which is CPU-bound. I call that 
speeding up the language :-)

Hypothetically, it could also speed up even unthreaded code.

Some language features could internally launch threads and operate using 
implicit parallelism. For instance, map(func, seq) could run in parallel 
in separate threads whenever Python knew that func had no side-effects, 
say for built-ins. There are also parallel algorithms for bignum 
arithmetic. If threads were quick enough, I'm sure we could come up with 
many more examples. Hypothetically speaking.

(In practice, the old hope that parallel computing would speed everything 
up turned out to be flawed. Relatively few tasks are embarrassingly 
parallel, most have sequential bottlenecks, and many are inherently 
sequential.)


>> (If it weren't for the EU government funding it, PyPy would probably be
>> languishing in oblivion. Everyone wants a faster Python so long as they
>> don't have to pay for it, or do the work.)
> 
> Hm, I didn't know the EU was funding PyPy. Okay. Cool.

I don't know if they still receive funding, but I know that PyPy really 
only got going in a big way when they got a grant from the EU. I think it 
paid for at least one developer to work on it full time for a year. 
DuckDuckGo is probably your friend if you care about the details.



-- 
Steve




More information about the Python-list mailing list