blog: Overlooked Essentials for Optimizing Code

Walter Bright newshound2 at digitalmars.com
Fri Sep 10 12:17:41 PDT 2010


bearophile wrote:
> Walter Bright:
> 
>> It turns out that dmd's runtime library function had a crummy
>> implementation of long division in it.<
> 
> In that case I have spent few hours narrowing the problem to a very small
> benchmark. Then I have left to you to spot and fix the precise cause of the
> low performance. And today I know x86 assembly a bit better :-)

Please forgive me for ragging on about this, but you had originally concluded 
that it was the code generator's fault. My point is that drawing such a 
conclusion would lead one to spend many hours fruitlessly looking in the wrong 
place for a solution, and that looking at the assembler would quickly point one 
in the right direction to getting it fixed.

I wrote about this issue because I see it all the time, and by experienced 
programmers.


>> I know a person who has done it (looked at the JIT output) with Java using
>> a debugger,
> I have done this often, many of my bug reports for LLVM compare the asm
> produced by LLVM with the asm produced by the Sun JavaVM: 
> http://weblogs.java.net/blog/2008/03/30/deep-dive-assembly-code-java See for
> example: http://llvm.org/bugs/show_bug.cgi?id=5501

Very nice, you should post that on reddit!



More information about the Digitalmars-d mailing list