mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] seq_file: Optimize seq_puts()
Date: Wed, 17 Apr 2024 09:53:43 +0200	[thread overview]
Message-ID: <935fea29-86ef-4cfb-a370-0b9616a0c279@prevas.dk> (raw)
In-Reply-To: <4b1a4cc5-e057-4944-be69-d25f28645256@wanadoo.fr>

On 15/04/2024 22.47, Christophe JAILLET wrote:
> Le 04/01/2024 à 14:29, Christophe JAILLET a écrit :
>> Most of seq_puts() usages are done with a string literal. In such cases,
>> the length of the string car be computed at compile time in order to save
>> a strlen() call at run-time. seq_write() can then be used instead.
>>
>> This saves a few cycles.
>>
>> To have an estimation of how often this optimization triggers:
>>     $ git grep seq_puts.*\" | wc -l
>>     3391
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Hi,
> 
> any feed-back on this small optimisation of seq_puts()?

While you're at it, could you change the implementation of the
out-of-line seq_puts (or __seq_puts if it gets renamed to that) to
simply be seq_write(seq, s, strlen(s)) instead of duplicating the
overflow/memcpy logic.

Rasmus


      parent reply	other threads:[~2024-04-17  7:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 13:29 Christophe JAILLET
2024-04-15 20:47 ` Christophe JAILLET
2024-04-15 21:00   ` Al Viro
2024-04-16 20:56     ` David Laight
2024-04-17  1:04       ` Al Viro
2024-04-19 18:59         ` Christophe JAILLET
2024-04-19 20:38       ` Christophe JAILLET
2024-04-19 21:32         ` Al Viro
2024-04-21 17:21         ` David Laight
2024-04-17  7:53   ` Rasmus Villemoes [this message]

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=935fea29-86ef-4cfb-a370-0b9616a0c279@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=brauner@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=jack@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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®