4 ms·
I wish this article included a benchmark of a large project and showed the difference each option made. I have a feeling most of these don't have much of an aff
by charcircuit 4y ago
I wish this article included a benchmark of a large project and showed the difference each option made. I have a feeling most of these don't have much of an affect.
- alpaca128 4y agoConsidering one of the listed options talks about "several kilobytes" of reduced size it's definitely not all a huge improvement. A standard stripping of debug information is probably one of the biggest and easiest steps. Using upx can also make a significant difference, but unfortunately not every OS likes the result. Mac OS just immediately killed my program when it was compressed like that.
- zabzonk 4y agoi don't think any of these will greatly, if at all, increase performance. they are of interest for people that are a) obsessive about program size or b) want to fit the compiled code into some very small storage device, such as a rom.
- nrclark 4y agoProgram size has a lot of interaction with performance, by way of your CPU's L2/L3 cache. If your program is too large, you get more cache misses when branching around. Frequent cache misses have a _huge_ effect on your code's overall performance, and can completely negate any of the wins you get from loop unrolling or other optimizations. This effect is very pronounced on small armv7l/aarch64 CPUs, which usually have much smaller caches than a desktop CPU. You can even see it on laptop CPUs too. It's impossible to know where exactly your size cutoffs are, because they depend a lot on what else is running in your system (and CPU core allocation, etc). But they 100% exist, for any program on any system. If your whole program can fit into your CPU cache, you'll see a big performance difference vs having to fetch it from RAM all the time.
- charcircuit 4y agoI never said "performance benchmark." By benchmark I meant you take a few programs like Chromium, clang, etc and measure how much savings each option gives.
- jeffbee 4y agoI agree. There are multiple thresholds where you care: the program is so large it cannot be linked; the program is too large to economically distribute; the program doesn't fit on the target media; the program would be faster if all hot code fit in L1i; the program is intended for competitive demos. Which are we discussing?