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

Chris Angelico rosuav at gmail.com
Fri Feb 23 11:42:43 EST 2018


On Sat, Feb 24, 2018 at 3:32 AM, Python <python at bladeshadow.org> wrote:
> On Fri, Feb 23, 2018 at 03:11:36AM -0500, Terry Reedy wrote:
>> >>Why do you care about the 50 million calls? That's crazy -- the important
>> >>thing is *calculating the Fibonacci numbers as efficiently as possible*.
>>
>> >If you are writing practical programs, that's true.  But the Julia
>> >benchmarks are not practical programs; they are designed to compare
>> >the performance of various language features across a range of
>> >languages.
>>
>> If that were so, then the comparison should use the fastest *Python*
>> implementation.
>
> Doing that would completely fail to accomplish the task of comparing
> the performance of recursive function calls in the two languages,
> which is what the benchmark was designed to do.  So, no actually, it
> shouldn't.
>

Where does the author say that the benchmark is designed to compare
recursion? If you specifically test recursion, some language
interpreters will perform really well (because they convert your
recursion into iteration) and others will not (because they faithfully
execute the code you actually ask them to). Recursion is sometimes a
good way to describe an algorithm, but rarely a good way to implement
it at a low level.

ChrisA



More information about the Python-list mailing list