I was going through Scott Meyer's podcast on CPU CACHES AND WHY YOU CARE It seems this will make code run faster, is there any open source where such coding is done for reference.
Or anybody has example of design of data structures/algorithms based on CPU caches aware
Asked
Active
Viewed 1,747 times
3

Avinash
- 12,851
- 32
- 116
- 186
-
2Related: http://en.wikipedia.org/wiki/Cache-oblivious_algorithm – Alexandre C. Oct 31 '11 at 07:53
-
7This question is _way_ too broad. How best to structure a data structure for optimal use of the cache depends on a great many things. The access patterns, when you access it, how big the elements are, etc. There's no one catch-all answer; that's why the podcast simply talks about how cached memory works. There's no "do this and your code gets faster" silver bullet. – Nicol Bolas Oct 31 '11 at 07:56
-
1If it wasn't phrased too broadly and in the "I have just read a blog that I found interesting" style, this question would still be a duplicate of http://stackoverflow.com/questions/763262/cache-efficient-code – Pascal Cuoq Oct 31 '11 at 08:05
-
And I found this other vague and general question by looking for something specific on "cache miss performance counter". Nothing turned up on StackOverflow, so you are left with Google, but it you start applying the ideas from the video you liked without having used those first to measure cache efficiency of your existing algorithm, you are wasting your time. – Pascal Cuoq Oct 31 '11 at 08:09
-
You'll find many relevant readings in the answers to http://stackoverflow.com/questions/6852670/how-to-write-fast-low-level-code – Szabolcs Oct 31 '11 at 09:35
2 Answers
2
Sure, the entire Linux kernel is implemented to be cache-aware.
For more details there is highly recommended paper What Every Programmer Should Know About Memory.

Maxim Egorushkin
- 131,725
- 17
- 180
- 271
1
Linear algebra is sensitive to cache problems. The BLAS subroutines allow one to abstract away from these concerns

Alexandre C.
- 55,948
- 11
- 128
- 197