Re:C performance mystery: delete unused string constant
by scoutt on Thursday June 25, 2020 @03:51AM
(#23637967)
Except when loops unrolls make things faster.
Re:C performance mystery: delete unused string constant
by ants_a on Thursday June 25, 2020 @05:02AM
(#23638457)
That only tends to be the case for tiny loops where loop iterator updates can be folded into addressing displacements and that frees up an execution port needed for something else.
If you don't know what you are doing unrolling is just as likely to hurt performance because you don't fit into uOP cache and get less decode bandwidth as a result. Or you increase ICache pressure on macro benchmarks and hurt real world performance. Modern cores are really good at hiding loop accounting overhead.
Re:C performance mystery: delete unused string constant
by scoutt on Thursday June 25, 2020 @08:29AM
(#23639876)
In a world where all the electronic devices are composed of x86 cores and/or have a data and/or instruction cache, it could be true.
But there are plenty of architectures out there where space-time tradeoffs (by optimized compilers) are still a thing (my PoV is from the embedded industry).
Agreed, in my experience, more often than not, size is speed. Small memory usage mean less cache misses, smaller memcpys, more chance of having data fit a single word, etc...