This is echoing Mike Acton’s admonishment that “where there’s one, there’s many”, a.k.a., the common case is more than one thing. It’s a really important lesson to learn as programmers. It might be simpler to think about how to design a single object rather than a collection of objects, but soon enough the performance penalties of accessing individual objects (e.g., cache misses) become problematic and, like the article points out, we need to reach for complex architectural solutions that we might not have needed (or not have needed as soon) had our initial design taken performance more in consideration.
If all 8 billion people on earth have 4 subscriptions each to whatever service this is, the optimized function will be called roughly 1 billion times per day. That’s 40 million times per hour, 1 million times per minute, or 20,000 QPS.
This is exactly the “Premature optimization” Knuth was talking about.
This is echoing Mike Acton’s admonishment that “where there’s one, there’s many”, a.k.a., the common case is more than one thing. It’s a really important lesson to learn as programmers. It might be simpler to think about how to design a single object rather than a collection of objects, but soon enough the performance penalties of accessing individual objects (e.g., cache misses) become problematic and, like the article points out, we need to reach for complex architectural solutions that we might not have needed (or not have needed as soon) had our initial design taken performance more in consideration.
If all 8 billion people on earth have 4 subscriptions each to whatever service this is, the optimized function will be called roughly 1 billion times per day. That’s 40 million times per hour, 1 million times per minute, or 20,000 QPS.
This is exactly the “Premature optimization” Knuth was talking about.
20,000 connections per second that could have been doing more. This is the systemic optimization that makes all future improvements possible.