Re: [PATCH v2 next 05/11] tools/nolibc/printf: Simplify __nolibc_printf()

From: Willy Tarreau

Date: Sat Feb 07 2026 - 15:07:48 EST


On Fri, Feb 06, 2026 at 07:11:15PM +0000, david.laight.linux@xxxxxxxxx wrote:
> From: David Laight <david.laight.linux@xxxxxxxxx>
>
> Move the check for the length modifiers into the format processing
> between the field width and conversion specifier.
> This lets the loop be simplified and a 'fast scan' for a format start
> used.
>
> If an error is detected (eg an invalid conversion specifier) then
> copy the invalid format to the output buffer.
>
> Reduces code size by about 10% on x86-64.

I'm surprised, because for me it's the opposite:

$ size hello-patch*
text data bss dec hex filename
1859 48 24 1931 78b hello-patch1
2071 48 24 2143 85f hello-patch2
2091 48 24 2163 873 hello-patch3
2422 48 24 2494 9be hello-patch4

The whole program grew by almost 16%, and that's a 30% increase since
the first patch. This is with gcc 15 -Oz. aarch64 however decreased by
15 bytes since previous patch.

I have not figured what makes this change yet, I'm still digging.

Willy