[Tutor] Python and Speed

VanL van@lindbergs.org
Mon, 16 Apr 2001 19:15:58 -0600


>

D-Man said:

> I think that this is a 'defect' in your benchmark.  I have seen
> several examples of perl (or other) programmers on c.l.py saying that
> Python is horribly slow in comparison to the other language.
>
> Then the gurus on c.l.py reworked their python code using more
> pythonic idioms and data structures and the speed became comparable.
> I think that for the benchmark to be "better" (by some definition of
> better <wink>) the most natural approach (algorithm, data structures)
> for each language must be used, even those approaches are almost
> certainly quite different.
>
> ......
> |       Finally, I would like this to provide the catalyst for the Perl and
> | Python communities to each agree on a set of common tasks which we could use
> | for benchmark testing each new release of these interpreters. I know that
> | Guido has never denied that Python is slower, but I'd like to be able to
> | quantify it against something a little less trivial than my own manufactured
> | example.

I would be very interested in this sort of test.

You mention that using identical data structures would be detrimental to the
integrity of the test -- definately so.  What about a standard set of tasks,
running the gamut from system administration tasks to database to algorithms and
scientific computing.  May the best implementation in each language win.

Then a weighted average of all the scores could determine (both within task
groups, and overall) a "fastest" language.  Moreover, if the set of tests were
broad enough, the temptation for the language writers to "write to the test" would
be diminished, in favor of better overall efficiency.  Scores could be weighted,
for example, to count consistent scores more heavily.

I think this sort of idea would be interesting for another reason, as well:  the
scripts themselves would be very instructive for aspiring programmers as a example
"best" implementation of a particular task.

Hmmmm.....