Skip to content
Unverified Commit 45751097 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Christian Brauner
Browse files

seq_file: Optimize seq_puts()



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_putc() or 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
   3436

   $ git grep seq_puts.*\".\" | wc -l
   84

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/a8589bffe4830dafcb9111e22acf06603fea7132.1713781332.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
The output for seq_putc() generation has also be checked and works.
parent 0a960ba4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment