maximse the use of cache in code

Z

zaheer031

Hi All,

How do I maximse the use of cache( both data and instruction ) in the
code .

I know use of loops and local variables will help but more would be of
good help


Thanks,
Zaheer.
 
W

Walter Roberson

How do I maximse the use of cache( both data and instruction ) in the
code .

comp.arch might be a better newsgroup for you, if you want
information on how various systems work with their caches (i.e.,
with a goal of writing cache-friendly code suitable for multiple
systems.) If you do not care about how cache-friendly your code is
on general systems as long as it maximizes the cache use on a
particular platform, then consult a newsgroup specific for that platform.

The C programming language says little or nothing about caches, and
does itself not provide any of the tools you would need to measure
or improve cache performance. Caching is a matter not within the
pervue of C itself, so this is not an appropriate newsgroup for
advice on cache use.

I know use of loops and local variables will help but more would be of
good help

Even that is wrong on some platforms. On some platforms, there is
a small section of memory at the beginning of the address space that
can be addressed with shorter faster instructions (fewer address
bits to work with.) On such systems, the best cache performance
might involve use of that small section of memory rather than involve
use of local variables: when instructions are shorter, more of them
fit into instruction cache. Thus, to maximize your cache use, you
need to use platform-specific information.
 
R

Ravishankar S

Hi All,

How do I maximse the use of cache( both data and instruction ) in the
code .

I know use of loops and local variables will help but more would be of
good help
ask in comp.arch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top