Cache efficient code

Posted by goldenmean on Stack Overflow See other posts from Stack Overflow or by goldenmean
Published on 2009-04-18T10:33:53Z Indexed on 2010/05/09 10:28 UTC
Read the original article Hit count: 473

Filed under:
|

This could sound a subjective question, but what i am looking for is specific instances which you would have encountered related to this.

1) How to make a code, cache effective-cache friendly? (More cache hits, as less cahce misses as possible). from both perspectives, data cache & program cache(instruction cache).

i.e. What all things in one's code, related to data structures, code constructs one should take care of to make it cache effective.

2) Are there any particular data structures one must use, must avoid,or particular way of accessing the memers of that structure etc.. to make code cache effective.

3) Are there any program constructs(if, for, switch, break, goto,...), code-flow(for inside a if, if inside a for, etc...) one should follow/avoid in this matter?

I am looking forward to hear individual experiences related to making a cache efficient code in general. It can be any programming language(C,C++,ASsembly,...), any hardware target(ARM,Intel,PowerPC,...), any OS(Windows,Linux,Symbian,...) etc..

More the variety, it will help better to understand it deeply.

© Stack Overflow or respective owner

Related posts about cache

Related posts about efficiency