3 ms·
But don't you end up doing unneeded optimizations? Optimizing the heck out of something that is in the cache 99% of the time seems like a waste.
by stonemetal 17y ago
But don't you end up doing unneeded optimizations? Optimizing the heck out of something that is in the cache 99% of the time seems like a waste.
- anamax 17y agoLet's do some arithmetic. Suppose that the unoptimized computation takes 200 units, the optimized takes 100 units and a cache access takes 1 unit. With a 99% hit rate, 100 accesses will take 100 units plus the cost of 1 computation. In the unoptimized case, that's 300 units, or an average of 3 units per access. In the optimized case, that's 200 units, or an average of 2 units per case. This ignores the user-experience benefit of serving that 1 access significantly faster.