|
From: <val...@ce...> - 2006-03-08 17:33:37
|
I am starting to use Valgrinds cachegrind to test my program for caches performance. Once i do this, how can I improve the cache performance? that is, how can I eliminate or reduce cache missies in my app? Are certain types of programming techniques more prone to cache misses? For example, nested loops? Certain data type declarations etc? Is there a good source of information on the internet? Thanks, CB |
|
From: Nicholas N. <nj...@cs...> - 2006-03-08 22:43:58
|
On Wed, 8 Mar 2006 val...@ce... wrote: > I am starting to use Valgrinds cachegrind to test my program for caches > performance. Once i do this, how can I improve the cache performance? that > is, how can I eliminate or reduce cache missies in my app? Are certain types > of programming techniques more prone to cache misses? For example, nested > loops? Certain data type declarations etc? Is there a good source of > information on the internet? There is no easy answer. Cachegrind points you in the right direction, but it can't tell you how directly how to fix your program. There is lots of information about caches on the internet, google for some. In general, try to make the crucial data structures smaller, and improve locality of accesses to them. Nick |
|
From: <val...@ce...> - 2006-03-09 22:14:38
|
[Ooops... I think the first time I responded to this the email went directly to Nick... sorry] Thanks for the info. I can now see where my cache misses are occurring most. I have a couple of more questions: Is a miss on the instruction cache as costly as on data cache? It appears that in some places I am approaching and even passing 50% miss rate on the data cache reads. This sounds pretty bad. What does "improve locality of accesses to them" mean in regards to the crucial data structure? Thanks, E Quoting Nicholas Nethercote <nj...@cs...>: > On Wed, 8 Mar 2006 val...@ce... wrote: > >> I am starting to use Valgrinds cachegrind to test my program for caches >> performance. Once i do this, how can I improve the cache performance? that >> is, how can I eliminate or reduce cache missies in my app? Are >> certain types >> of programming techniques more prone to cache misses? For example, nested >> loops? Certain data type declarations etc? Is there a good source of >> information on the internet? > > There is no easy answer. Cachegrind points you in the right > direction, but it can't tell you how directly how to fix your > program. There is lots of information about caches on the internet, > google for some. In general, try to make the crucial data structures > smaller, and improve locality of accesses to them. > > Nick > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Nicholas N. <nj...@cs...> - 2006-03-10 04:08:45
|
On Thu, 9 Mar 2006 val...@ce... wrote: > Is a miss on the instruction cache as costly as on data cache? Probably. > It appears that in some places I am approaching and even passing 50% miss > rate > on the data cache reads. This sounds pretty bad. Yes, that's very bad. > What does "improve locality of accesses to them" mean in regards to the > crucial > data structure? Google for "locality". Basically, you want your memory accesses to be clustered close together as much as possible. If you're randomly jumping all over memory that will be bad for cache performance. Nick |