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

Python python at bladeshadow.org
Fri Feb 23 14:41:17 EST 2018


On Sat, Feb 24, 2018 at 06:16:38AM +1100, Chris Angelico wrote:
> > It seems abundantly clear to me that testing recursion is the point of
> > writing a benchmark implementing recursion (and very little of
> > anything else).  Again, you can decide for yourself the suitability of
> > the benchmark, but I don't think you can really claim it doesn't
> > effectively test what it means to.
> 
> Where do you get that it's specifically a recursion benchmark though?
> I can't find it anywhere in the explanatory text.

I don't know how you could conclude it could be meant to test anything
else.  The code is:

    ## recursive fib ##
    fib(n) = n < 2 ? n : fib(n-1) + fib(n-2)

What else is there of substance to test?  Trigraphs?  Addition?  The
comment even calls out that it is recursive.

I further draw inference from the two statements:

1. "Instead, the benchmarks are written to test the performance of
   identical algorithms and code patterns implemented in each
   language."

Calling out explicitly that it is algorithms that they are testing,
and here the algorithm is a recursion.

2. "For example, the Fibonacci benchmarks all use the same
   (inefficient) doubly-recursive algorithm..."  
   
They expressly called out this algorithm as being inefficient, and
expressly called it out as being double-recursion.

I'll grant you they never explicitly said so unequivocally (that I
saw--my reading of their site was not exhaustive), but I can't see any
way an informed reader could conclude any different purpose other than
benchmarking recursion.




More information about the Python-list mailing list