platform.txt: instruct GCC to perform more aggressive optimization by jjsuwa-sys3175 · Pull Request #7770 · esp8266/Arduino (original) (raw)
i guess that smallness regarding the executable binaries is virtue, especially in embedded systems.
I tried an example that I thought might show some better results, BearSSL_Validation.
On the one hand, this has a lot of smaller functions both inside the .A and the WiFi core, so gives more chance for savings. On the other hand, it uses virtuals (both c++ and emulated C) which means that inter-procedure analysis can't be done since you don't know at build-time what code will be called.
Results are as follows:
master
IROM | 364600
IRAM | 27392
DATA | 1356
RODATA | 3844
BSS | 25640
With this patch
IROM | 364488
IRAM | 27396
DATA | 1356
RODATA | 3832
BSS | 25640
112-4 byte savings (IRAM 4 bytes bigger)
Rebuilding BearSSL .a with same settings + this patch
IROM | 364424
IRAM | 27396
DATA | 1356
RODATA | 3832
BSS | 25640
176-4 byte savings (IRAM again is 4 bytes larger w/the patch).
I'm running a 1st gen Xeon E5 system and I didn't notice any time difference in builds, FWIW.
So, @jjsuwa-sys3175 , I'll approve this and add it to BearSSL's build. We'll update the versionj when Newlib 4.0 comes in #7708.