Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: assembler vs. C

Author: Gunnar Andersson

Date: 00:42:41 11/09/99

Go up one level in this thread


On November 09, 1999 at 01:39:12, David Blackman wrote:

>But for standard integer mode on normal chips such as Intel X86 and most risc
>chips, i can't see how you would beat the compiler by a factor of two. Popular
>high level languages map down to the instructions very well, and the best
>compilers do an excellent job of register allocation, scheduling to avoid
>pipeline stalls, etc. If you can say it in X86 assembler, you can nearly always
>say it at least as clearly in C.

Compilers are good at local manipulations, such as register allocation, but they
can't take the global view necessary to find the right level of optimization
which results in the L1 code cache being used such that there are no overflows -
on the Pentium II this means that your program can only use at most 16kb of
object code, less if it is not in a contiguous memory region.

I've seen six-fold speedups when tweaking the compiler flags to gcc dealing with
this phenomenon. Often it is the case that you have to avoid functions being
inlined by using -fno-inline-functions, otherwise the compiler tries to be
"optimize" the code resulting in the size of the object code increasing.

/ Gunnar



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.