[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251107161130.4418562992d2477c4accc6ef@linux-foundation.org>
Date: Fri, 7 Nov 2025 16:11:30 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Junrui Luo <moonafterrain@...look.com>, linux-kernel@...r.kernel.org,
pmladek@...e.com, rostedt@...dmis.org, andriy.shevchenko@...ux.intel.com,
tiwai@...e.com, perex@...ex.cz, linux-sound@...r.kernel.org,
mchehab@...nel.org, awalls@...metrocast.net, linux-media@...r.kernel.org,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH 1/4] lib/sprintf: add scnprintf_append() helper function
On Fri, 7 Nov 2025 09:12:46 +0000 David Laight <david.laight.linux@...il.com> wrote:
> > I wonder if we should instead implement a kasprintf() version of this
> > which reallocs each time and then switch all the callers over to that.
>
> That adds the cost of a malloc, and I, like kasprintf() probably ends up
> doing all the work of snprintf twice.
There is no need at all to optimize the performance of scruffy once-off
string pasting functions. For these it's better to optimize for
readability, reliability. maintainability.
Powered by blists - more mailing lists