[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260207235019.40f82fca@pumpkin>
Date: Sat, 7 Feb 2026 23:50:19 +0000
From: David Laight <david.laight.linux@...il.com>
To: Willy Tarreau <w@....eu>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org, Cheng Li <lechain@...il.com>
Subject: Re: [PATCH v2 next 05/11] tools/nolibc/printf: Simplify
__nolibc_printf()
On Sat, 7 Feb 2026 21:05:42 +0100
Willy Tarreau <w@....eu> wrote:
> On Fri, Feb 06, 2026 at 07:11:15PM +0000, david.laight.linux@...il.com wrote:
> > From: David Laight <david.laight.linux@...il.com>
> >
> > 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.
Running scripts/bloat-o-meter will give more detail.
> Willy
I'm using gcc 12.2 and just running 'make O=xxx' for the test program.
The object looks like what I'd expect, so might be -O2.
Is it constant folding the #defines.
For me it generating the (1 << (c & 31)) & 0xxxxx as you might hope.
David
Powered by blists - more mailing lists