Thread (62 messages) flat view 62 messages, 25 authors, 2016-06-15

Re: [RFC] Convert builin-mailinfo.c to use The Better String Library.

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:43:34

Wincent Colaiuta wrote:
El 7/9/2007, a las 15:58, Andreas Ericsson escribió:
quoted
Yes, but that's what I said in the original email as well. C is just so
much more pleasant to write in that the only place you'd (sanely) use
asm is in exactly these tight loops, where the code is likely to be used
and reused until the algorithm it describes is no longer a viable option
for doing what it was originally designed to do.

It still proves the point though, as surely as n+1 > n for any value 
of n:
Hand-optimized assembly is faster than compiler-optimized C code.
In a theoretical ideal world, yes; no one would argue that C is faster 
than fine-tuned assembly.

But in the *real world* rewriting Git in assembly would be like painting 
a house using a single horse hair instead of a paint brush or roller. 
Your SHA-1 example is a perfect example of where you benefit from doing 
a tiny embellished detail using the single hair (assembly) and leave all 
the rest in C.

In the real world and not the theoretical ideal world, it's not just 
about the diminishing returns you get from writing more and more of a 
code base in assembly instead of just the performance-critical 
bottlenecks; it's that you're more likely to make subtle mistakes or 
even make things slower. GCC does a remarkable job of optimizing in a 
huge number of use cases, and best of all, it does it for free. Personal 
opinion, of course, but that's the way I think it is.
The discussion was theoretical from the beginning. Nobody's arguing that
git should be rewritten in asm, and you've been preaching to the choir far
too long now. I'll just drop this thread.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help