Re: [PATCH] vsprintf: uninline simple_strntoull(), reorder arguments

From: Petr Mladek
Date: Wed Nov 01 2023 - 12:48:55 EST


On Fri 2023-10-27 17:13:58, Alexey Dobriyan wrote:
> * uninline simple_strntoull(),
> gcc overinlines and this function is not performance critical
>
> * reorder arguments, so that appending INT_MAX as 4th argument
> generates very efficient tail call
>
> Space savings:
>
> add/remove: 1/0 grow/shrink: 0/3 up/down: 27/-179 (-152)
> Function old new delta
> simple_strntoll - 27 +27
> simple_strtoull 15 10 -5
> simple_strtoll 41 7 -34
> vsscanf 1930 1790 -140
>
> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>

I am usually quite skeptical about these micro-optimizations. They might
help only on some architectures with some compiler versions. And
they might make it worse for others.

Well, I could imagine that passing constant via the last parameter
might help in most cases. And the new ordering of the parameters
is fine. So let's get it in.

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

I have just pushed the patch into printk/linux.git, branch for-6.7.

Best Regards,
Petr