I recall having the cache epiphany back in the day when I was profiling my app and it kept highling a section that used a lot of time for inconsequential work.
Took me some time before I realized that it was missing the cache ~100% of the time due to how it walked the data structure.
Also be aware of how things are profiled. Profilers that surround functions with stopwatches tend to inflate the cost of calling simple functions. I genrally prefer sampling profilers but they both have their pros and cons.
I recall having the cache epiphany back in the day when I was profiling my app and it kept highling a section that used a lot of time for inconsequential work.
Took me some time before I realized that it was missing the cache ~100% of the time due to how it walked the data structure.
Also be aware of how things are profiled. Profilers that surround functions with stopwatches tend to inflate the cost of calling simple functions. I genrally prefer sampling profilers but they both have their pros and cons.