
global/static vars inside loops
Quote:
> In Michael Lee's insightful and handy "Optimization of Computer
> Programs in C" we are urged to "avoid referring to global or
> static variables inside the tightest loops".
> What is then the justification for the above quote?
I don't think there is any.
Any decent modern C compiler distributes (factors) high-overhead
operations out of loops, for example caching nonlocal references.
It is best to write the program as clearly as possible and *then*
worry about micro-optimization tweaks *if* you find that they are
needed to meet performance goals.
--