Computer Chess Club Archives


Search

Terms

Messages

Subject: cache optimization

Author: martin fierz

Date: 02:10:26 06/07/01


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...

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.