El 7/9/2007, a las 15:58, Andreas Ericsson escribió:
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.
Cheers,
Wincent
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html