[Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

Chris Angelico rosuav at gmail.com
Fri Jan 26 21:29:38 EST 2018


On Sat, Jan 27, 2018 at 10:07 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Sat, Jan 27, 2018 at 09:12:29AM +1100, Chris Angelico wrote:
>
>> Are you sure it's the language's fault? Failing to use a better data
>> type simply because some other language doesn't have it is a great way
>> to make a test that's "fair" in the same way that Balance and
>> Armageddon are "fair" in Magic: The Gathering. They reset everyone to
>> the baseline, and the baseline's equal for everyone right?
>
> I'm afraid I have no idea what that analogy means :-)
>

When you push everyone to an identical low level, you're not truly
being fair. Let's say you try to benchmark a bunch of programming
languages against each other by having them use no more than four
local variables, all integers, one static global array for shared
storage, and no control flow other than conditional GOTOs. (After all,
that's all you get in some machine languages!) It's perfectly fair,
all languages have to compete on the same grounds. But it's also
completely UNfair on high level languages, because you're implementing
things in terribly bad ways. "Fair" is a tricky concept, and coding in
a non-Pythonic way is not truly "fair" to Python.

ChrisA


More information about the Python-ideas mailing list