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

Python python at bladeshadow.org
Thu Feb 22 20:36:21 EST 2018


On Thu, Feb 22, 2018 at 11:29:53PM +1100, Chris Angelico wrote:
> > The idea of the Fibonacci benchmark is to test how effectively an
> > implementation manages large numbers of recursive function calls. Then,
> > fib(36) would normally involve 48,315,633 calls.
> >
> > This version does only 37, giving a misleading impression.
> 
> Not overly misleading; the point of it is to show how trivially easy
> it is to memoize a function in Python. 

This does not appear to me at all to be the point of the article.  The
point of the article seems to be that the Julia benchmarks compare
unfairly the performance of Python to Julia, because they do not use
algorithms that suit "the best way to use Python."  But I have to
agree with bartc, that is not at all the point of the benchmarks.  The
point of the benchmarks is to compare the performance of a particular
algorithm or set of algorithms across a variety of languages.

It's fine to say that this method of computing Fibonacci sequences is
inefficient; but anyone who's spent any time on the problem knows that
recursive function calls is not the most efficient way to calculate
them in most languages.  So it must follow logically that the point of
the benchmark is not to prove that Julia is faster than Python at
solving Fibonacci sequences, but rather that Julia is faster than
Python at solving the class of problems that would be implemented in a
similar manner as this particular implementation of Fibonacci
sequences.

No other interpretation makes any sense.  And if that is the point, as
logic dictates, then comparing the performance of algorithm A
implemented in language X to the performance of a completely different
algorithm B in language Y is generally both misleading and pointless.

If you can prove that A is the most efficient alogorithm possible in X
and B is the most efficient algorithm in Y, for solving the same
problem, then and only then, you might have something.  Otherwise, I
think what you're saying is bunk.




More information about the Python-list mailing list