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

From: H. Peter Anvin
Date: Mon Jun 06 2011 - 13:08:37 EST


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@xxxxxxxxx>

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@xxxxxxxxx>

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/