Re: coding for optimizations (Re: [PATCH 1/2] i386: mce cleanup part1: functional change)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Adrian Bunk
Date: Wednesday, October 10, 2007 - 4:14 pm

On Tue, Oct 09, 2007 at 08:30:11PM +0200, Joerg Roedel wrote:

Please don't let Oley bring you away from the right path.

It is your job to write readable C code, and it's the compiler's job to 
transform this C code into efficient machine code.

And non-ancient gcc versions are usually quite good in optimizing code.

And saving code in a variable before using it might even result in the 
same assembler code.

It is personal preference whether you use variables or not in this case 
(both seem to be equally readable) so you can do it any way you like, 
but don't try to guess what gcc might make out of it.

We have problems with the size of the kernel image, but we need to solve 
them with the bigger knobs that have measurable effects, not by wasting 
our time on guessing how gcc might handle a single if.

It's also a quite ill idea to think about whether gcc might produce a 
few bytes more or less code at the if when there's such a long printk() 
in the middle...

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/2] i386: MCE updates, Joerg Roedel, (Tue Oct 9, 5:49 am)
[PATCH 1/2] i386: mce cleanup part1: functional change, Joerg Roedel, (Tue Oct 9, 5:49 am)
Re: [PATCH 1/2] i386: mce cleanup part1: functional change, Valdis.Kletnieks, (Tue Oct 9, 1:46 pm)
Re: coding for optimizations (Re: [PATCH 1/2] i386: mce cl ..., Adrian Bunk, (Wed Oct 10, 4:14 pm)