Re: [PATCH 1/1] boot: Enhance performance by eliminating unnecessary calls to printf()

H. Peter Anvin
2011-06-06T17:08:35Z

On 06/05/2011 05:40 PM, Jean Sacren wrote:
> Hi,
>
> Repeated calling to printf() for 13 times is a dire waste of CPU cycles.
> For performance, combine all those calls into one while source code
> formatting is preserved for readability.
>
> Compile tested only.
>
> Signed-off-by: Jean Sacren <sakiwit@gmail.com>

You're got to be bloody kidding.

First of all, this is a build time tool which is executed exactly once
during the entire kernel build.

Second, printf execution time is largely dependent on the size
formatting string; since the I/O is buffered it is only issued once
anyway... which basically means that there is no time saved at all.

Third, the resulting code is substantially harder to read.

Fourth, carrying this as a patch will cost kernel developers more time
in additional git execution time than it ever will save them in build time.

Nacked-by: H. Peter Anvin <hpa@zytor.com>

-hpa