Advertisement Jump to content


This topic is now archived and is closed to further replies.


Avoiding cache misses

This topic is 5338 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Use temporal and spatial locality in your data, reduce the generated code size, use smaller data structures and pay attention to your profiler.

For more complete answers, you might want to check out the book Small Memory Software, or any basic book on computer architecture geared towards computer science majors.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
It''s not uncommon that compiling with "optimize for size" results in better performance that "optimize for speed", mainly because of better cache usage.

Single cache misses isn''t too bad, ~8-10 cycles for L1 miss and ~40-50 for L2 miss. In addition, the CPU/chipset prefetching can sometimes lower those figures.

Having several threads doing work on a single CPU will likely result in burning caches if all threads'' local data can''t be held in the cache. So keeping thread count low is a good idea. For most games that''s probably not an issue though, but for a server side application it''s a real-world problem.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!