rhodri at wildebst.org.uk
Wed Mar 12 01:57:59 CET 2014
On Tue, 11 Mar 2014 04:28:25 -0000, Chris Angelico <rosuav at gmail.com>
> 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>
>>> 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
>> 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 might be true for x86, but it isn't true for ARM for example.
Apparently it's algorithmically hard to generate ARM code that makes
efficient use of conditional instructions, and I can almost always write
tighter, faster code than the compiler generates in consequence. It's not
always worth the extra coding time (longer now that I'm not in practise),
but that's a separate matter.
Rhodri James *-* Wildebeest Herder to the Masses
More information about the Python-list