3 ms·
Modifying a constant in code might make sense because it saves several precious bytes of variable storage.
by codedokode 1mo ago
Modifying a constant in code might make sense because it saves several precious bytes of variable storage.
- inigyou 1mo agoNo, it might make sense because it saves precious memory bandwidth as well as uop count. This code wasn't called that often, generally once per drawing operation, but I don't like being uselessly wasteful - that mindset is how software got so bloated. Your program is either front-end stalled by uop count or instruction cache latency, or back-end bound by memory bandwidth or ALU throughput or a serial dependency chain. It doesn't matter which is the bottleneck for this case, because inlining constants improves most of the above!
- inigyou 1mo agos/stalled/bound/ When the back end is the bottleneck, the front end stalls and vice versa, though I'm not sure how all processors report it.