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

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Feb 23 13:14:22 EST 2018


On Fri, 23 Feb 2018 10:50:50 -0600, Python wrote:

> On Fri, Feb 23, 2018 at 01:38:01AM -0500, Terry Reedy wrote:
>> It is no secret that Python's interpreted function calls are slower
>> than function calls compiled to machine code and that Python's infinite
>> precision integer arithmetic is slower  that machine int arithmetic. 
>> So there is almost no point in combining both in a naive drastically
>> inefficient algorithm and declaring that Python is slower.
> 
> I never said the benchmarks chosen were awesome...  :-)  What I'm saying
> is this:
> 
> 1. Insistence that the most efficient python implementation of Fib
>    completely misses the point (and defeats the purpose) of the
>    benchmarks, and as such the entire article is lost in the weeds.

The point of the benchmarks is to highlight how great Julia is, and why 
people should choose it over Python.

The point of the article is to show how to take badly written, 
unidiomatic, slow code written in Python, and modify it to be better, 
faster code competitive (if not faster than) Julia, while remaining 
within the Python ecosystem.

We aren't limited to the two options the benchmarks suggest: "Fast Julia! 
Slow Python!". (Three, if you include C.) We can take a third option: "we 
reject your crappy algorithms and write code like a professional".

https://allthetropes.org/wiki/Take_a_Third_Option



-- 
Steve




More information about the Python-list mailing list