[LC++]optimizing array access: x86 instruction timings

Karen Shaeffer shaeffer at neuralscape.com
Thu Jan 29 14:08:01 UTC 2004


On Thu, Jan 29, 2004 at 04:09:12PM +1030, Dr Mark H Phillips wrote:
> Hi,
> 
> I am trying to work out efficiency issues with using
> loops.

Howdy,

In general, pointers are more efficient than indexing.

You can get exact timing information from minimal code sequences using time
functions from the c library. If you want to do even better, look into the
X86 instruction set for the time stamp counter (TSC) instructions. These are
hardware based and do not impact the run time of code. You can extract the
exact run-time characteristics with TSC based code. This can be embedded
into your c program using inline assembly techniques.

cheers,
Karen
-- 
 Karen Shaeffer
 Neuralscape, Palo Alto, Ca. 94306
 shaeffer at neuralscape.com  http://www.neuralscape.com



More information about the tuxCPProgramming mailing list