4 ms·
Even in code like this just being aware of cache levels and there relative timings can sometimes produce some impressive speedups with simple things like sortin
by flukus 6y ago
Even in code like this just being aware of cache levels and there relative timings can sometimes produce some impressive speedups with simple things like sorting the initial data to make it cache friendly. A recent one I improved was along the lines of:
for t in transactions
t.client = clients[t.ClientId]
t.product = products[t.ProductId]
In this case sorting transactions by ClientId, ProductId was an orders of magnitude speedup because client and product were already in cache in L1/L2 cache most of the time. It could have been faster again with less SOLID but improvements like this are often easy and politically achievable because it keeps the sacrifice to the OO gods.
Treating Big O as the be all of performance has quite a lot to answer for in real world code, often constants aren't so constant.