Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: cache optimization

Author: Johan Melin

Date: 11:39:15 06/07/01

Go up one level in this thread


On June 07, 2001 at 05:10:26, martin fierz wrote:

>hi,
>
>this is from an earlier post of bob hyatt:
>
>>That is a basic optimization strategy...  variables used close together in
>>time should be close together in memory to take advantage of 32-byte line
>>fills in cache.
>
>is this somthing which everybody is doing? is it worth the trouble to move
>around variable declarations? if this is optimized, how much performance
>gain can you expect compared to random variable placing?
>are there any other strategies to optimize a program for good cache performance?
>and how do you measure this, if ordering the variables in one function causes
>that function to be 1% faster & the overall program 0.01% or something? just
>so i can try it in one function for starters...

Small, local variables in a function do not have cache problems.
The problem is when you have large tables with data. Then you need to worry
about how the data is organized.

/Johan Melin

>here's another observation i made: i have a P4 [i know... no need to tell me
>that it's a bad choice :-)] desktop and a P3 laptop. i tried bobs recommendation
>to use char and short arrays for small variables (like my
>"lastbit" array), and on the P3 this was indeed faster - on the P4 it was
>slower though. is this to be expected?
>
>cheers
>  martin



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.