Balanced trees

Chris Angelico rosuav at gmail.com
Tue Mar 11 05:28:25 CET 2014


On Tue, Mar 11, 2014 at 2:38 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Mon, Mar 10, 2014 at 7:45 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> No no,
>> I could make this so much better by using the 80x86 "REP MOVSW"
>> command (or commands, depending on your point of view). That would be
>> so much better than all those separate operations the silly compiler
>> was doing! Roughly an hour of fiddling later, making sure it all still
>> worked correctly, I discover that... hmm, it's not actually any
>> faster.
>
> Better to have tried and failed though than to have simply accepted
> what the compiler was doing with no verification at all.

Maybe. But I've learned now that one guy who used to do assembly
language programming on an 8086 is unlikely to discover something that
the many authors of a C compiler haven't noticed. Yes, it's possible
there'll be something specific to my code, like if I'm doing a
strcpy-like operation that isn't *actually* strcpy (the function will
be optimized heavily, but a C-level loop might not be recognized), but
it's more likely the compiler knows better than I do.

That, by the way, was before I realized that *interpreter* writers are
more expert than I am, too, and therefore that I can trust a
heavily-optimized high level language to run my code faster than I
could write equivalent C.

ChrisA



More information about the Python-list mailing list