When looking at code size for different functions, I noticed that gcc with -O3 generates horribly large code for the file_open* functions in modules/_Stdio/file.c. Adding ATTRIBUTE((optimize("Os"))) to those saves about 15 kB. For file_open its 5 kB vs 1 kB. With -O3 gcc ends up generating an impressive 32 calls to open64...
arne
On Sat, 10 May 2014, Arne Goedeke wrote:
On Thu, 8 May 2014, Arne Goedeke wrote:
I have a branch lying around which does some de-inlining in sprintf. It reduces code size by half. There was no real speed advantage, but I only ran some micro benchmarks on i7, so I assume there was no cache pressure.
I pushed those sprintf de-inlining changes into a new branch 'arne/slim'. That patch alone makes sprintf about 75% smaller. During my yesterday train ride I wrote another patch that changes the generation of sscanf functions. Instead of having one funciton for each strings width of both the format and the input, it uses the PCHARP accessor functions for the format. I have not run any benchmarks to see how much slower it is, but it saves about 60% of code size there.
arne