Re: [RFC] Convert builin-mailinfo.c to use The Better String Library.
- From
Andreas Ericsson <ae@op5.se>
- Date
- Sep 7, 2007, 13:58 UTC
- Message-ID
- <46E1590A.4060504@op5.se>
- In-Reply-To
- <E4A6490A-ABA9-4383-978E-C7F2E4BC9C23@wincent.com>
Wincent Colaiuta wrote:
Show 31 quoted lines
> El 7/9/2007, a las 13:54, Andreas Ericsson escribió: > >> Johannes Schindelin wrote: >>> Hi, >>> On Fri, 7 Sep 2007, Andreas Ericsson wrote: >>>> Wincent Colaiuta wrote: >>>>> El 7/9/2007, a las 2:21, Dmitry Kakurin escribi?: >>>>> >>>>>> I just wanted to get a sense of how many people share this "Git >>>>>> should >>>>>> be in pure C" doctrine. >>>>> Count me as one of them. Git is all about speed, and C is the best >>>>> choice >>>>> for speed, especially in context of Git's workload. >>>>> >>>> Nono, hand-optimized assembly is the best choice for speed. C is just >>>> a little more portable ;-) >>> I have a buck here that says that you cannot hand-optimise assembly >>> (on modern processors at least) as good as even gcc. >> >> >> http://www.gelato.unsw.edu.au/archives/git/0504/1746.html >> >> I win. Donate $1 to FSF next time you get the opportunity ;-) > > Well, you picked a very specific algorithm amenable to that kind of > optimization: small, manageable, with a minimal and well-defined > performance critical section that could be written in assembly. Note how > a good chunk of the implementation was still in C. At most I'd give you > 75 cents for that one. ;-) >
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.
It might be harder to do properly on some architectures than others (RISC comes to mind), but it's still possible.
-- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231