3 ms·
> Premature optimisation is the root of all evil If you're going to quote Knuth you better be damn sure you've fully understood him. The quote in question is
by biorach 2y ago
> Premature optimisation is the root of all evil
If you're going to quote Knuth you better be damn sure you've fully understood him.
The quote in question is about micro-optimisations which were pointless on account of design issues. The situation you are commenting on is kind of the opposite.
- PaulHoule 2y agoI would say this debate https://en.wikipedia.org/wiki/AoS_and_SoA https://en.wikipedia.org/wiki/AoS_and_SoA (which I think is weakened in the Wikipedia version) goes to the heart of where profiling can hide huge opportunities for optimization. It is a good prop bet that rewriting something (that doesn't allocate lots of dynamic memory) that is SoA style in AoS style will speed it up significantly. The victim is emotionally attached to their code and the profiler would never show you the many small costs, often distributed through the memory system, that add up. In a case like that they might accuse you of cheating by applying a bunch of small optimizations which are often easier to express in SoA if not downright obvious. When they apply the same optimizations to their code they will speed it up but not as much. Oddly it's a discussion that's been going on even since people were writing games in assembly language in the 1980s and probably since that; it would be interesting to see more tools which are AoS on the inside but look SoA on the outside.