mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vsprintf: uninline simple_strntoull(), reorder arguments
Date: Mon, 30 Oct 2023 10:59:24 +0200	[thread overview]
Message-ID: <ZT9wbLC9Nl+mKes3@smile.fi.intel.com> (raw)
In-Reply-To: <82a2af6e-9b6c-4a09-89d7-ca90cc1cdad1@p183>

On Fri, Oct 27, 2023 at 05:13:58PM +0300, 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


Makes sense to me
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

>  		if (is_sign)
> -			val.s = simple_strntoll(str,
> -						field_width >= 0 ? field_width : INT_MAX,
> -						&next, base);
> +			val.s = simple_strntoll(str, &next, base,
> +						field_width >= 0 ? field_width : INT_MAX);
>  		else
> -			val.u = simple_strntoull(str,
> -						 field_width >= 0 ? field_width : INT_MAX,
> -						 &next, base);
> +			val.u = simple_strntoull(str, &next, base,
> +						 field_width >= 0 ? field_width : INT_MAX);

Looking at these, why do we even care about signedness? field_witdh IIRC is 16-bit or less
and if size_t is to big it's still fine. No?

-- 
With Best Regards,
Andy Shevchenko



       reply	other threads:[~2023-10-30  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <82a2af6e-9b6c-4a09-89d7-ca90cc1cdad1@p183>
2023-10-30  8:59 ` Andy Shevchenko [this message]
2023-11-01 16:48 ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZT9wbLC9Nl+mKes3@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®