[PATCH 2/2] getopt.c: use fputs()/fputc() instead of fprintf() to, save code space

Freddie Chopin freddie_chopin@op.pl
Sat Nov 9 07:56:00 GMT 2013


W dniu 2013-11-09 04:24, Craig Howland pisze:
> I am curious:  what were your the overall savings?

In case of my current project, which does use some formatted output, but 
only with integer versions of printf(), the code with original getopt() 
uses 151kB, while getopt() with fputs()/fputc() uses 134kB, so 17kB 
less. I could also try to check how much is pulled into an empty project 
when adding getopt(), so that would show the absolute size difference.

The change of RAM usage is really hard to measure, but if you'd really 
like to know that, I could try to check that too. I suspect it would be 
a couple hundred bytes of stack.

Regards,
FCh



More information about the Newlib mailing list