Caches everywhere? Measure!

Caches everywhere? Measure!
aka Premature optimization is the root of all evil
(Part 5,000,000 and counting...)

Today I had to optimize some code as the applications memory growth went up to 1,5 GByte during runtime. Using my memory profiler (http://ddobjects.de/dddebug) - yes, I am using my own tools ;) - I realized quickly, that there has been a cache which did grow endlessly. Well... it even seemed, no one ever did check the cache usage: the hit/miss ratio was somewhere around 1 to 5 and worse. As the cache did contain Bitmaps of different size the memory usage was huuuuge. In the end, Knuth proofed to be right again. Disabling the cache did lead to no performance penalty and memory usage is stable now: down from 1,5 GByte to 100 MByte.
http://ddobjects.de/dddebug

Comments