Is this make sence? Dynamic assembler for python

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Sun Jun 20 23:34:40 EDT 2010


On Sun, 20 Jun 2010 22:45:14 +0100, Rhodri James wrote:

> Mixing Python and assembler is a bizarre thing to want to do in general,
> but...
> 
> On Sun, 20 Jun 2010 01:52:15 +0100, Steven D'Aprano
> <steve at remove-this-cybersource.com.au> wrote:
> 
>> (3) Modern C compilers can produce better (faster, more efficient)
>> machine code than the best assembly code written by hand.
> 
> No.  Modern C compilers often produce very good machine code, but the
> best hand-written assembly code will be better.  I can usually write
> *very* marginally better code than GCC achieves at work, though 99% of
> the time I don't because it would be a maintenance nightmare.


Not that I don't believe you, but that is an extraordinary claim that 
would require more evidence than just "Hey, some guy on the Internet 
reckons his assembly code can regularly out-perform optimizing C 
compilers" before I will change my opinion *wink*

Of course, there almost certainly are special cases where the state of 
the art for optimizing C compilers isn't as good as a clever human, e.g. 
if you're writing for hardware where no optimizing compiler exists at 
all, or some tiny CPU without all the pipelines and predictive branching 
crap^W stuff they do these days.



-- 
Steven



More information about the Python-list mailing list