[Python-Dev] Silly little benchmark

Jeremy Hylton jeremy@alum.mit.edu
Thu, 12 Jul 2001 12:26:51 -0400

    Thomas> Don't forget to do meaningful performance comparisons before and
    Thomas> after ;P

It's that adjective "meaningful" that makes it difficult...

>From http://mail.python.org/pipermail/python-dev/2001-May/014911.html:

"""It looks like the new coercion rules have optimized number ops at the
expense of string ops.  If you're writing programs with lots of
numbers, you probably think that's peachy.  If you're parsing HTML,
perhaps you don't :-).

I looked at the test suite to see how often it is called with
non-number arguments.  The answer is 77% of the time, but almost all
of those calls are from test_unicodedata.  If that one test is
excluded, the majority of the calls (~90%) are with numbers.  But the
majority of those calls just come from a few tests -- test_pow,
test_long, test_mutants, test_strftime.

If I were to do something about the coercions, I would see if there
was a way to quickly determine that PyNumber_Add() ain't gonna have
any luck.  Then we could bail to things like string_concat more