JuliaLang/julia — pull request #1084 by larsmans (2012-07-25 16:12:08+00:00)
Title: Python benchmark

Dear Julia developers,

After seeing how poorly Python performs in [your benchmark](http://julialang.org/), I decided to check out its code that you claim gives "a sense for how easy or difficult numerical programming in each language is". I found that your Python code is not quite idiomatic, is ambiguous about its use of NumPy (which practically any Python number crunching program will use) and therefore misrepresents Python's performance for numeric tasks.

I've taken the liberty of submitting three possible improvements in this PR.

The first contains a rewritten `pisum` benchmark using NumPy idioms, which makes it an order of magnitude faster on my machine, after correction of the mistake that the benchmark runs its outer loop 499 times instead of 500.

The second is a micro-optimization achieved by using ordinary Python idioms throughout the code.

The third replaces the quicksort benchmark with a call to NumPy's version of quicksort. No Python programmer would actually write a sorting routine themselves in pure Python, since the language is simply not intended to be used this way, and it goes against the "batteries included" philosophy.

(I also think the `fib` benchmark is particularly flawed, as it's not representative of any practical numerical algorithm that I know of. Python in particular is *not* optimized for recursion and iteration is preferred throughout.)

You're free to cherry-pick any selection of the commits in this branch, but I do urge you to hedge the claims pertaining to your benchmarks more carefully. I also wish you the best of luck with the interesting language you are developing.