Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern



On Sun, Jan 03, 2010 at 08:58:37AM -0800, Matt Thomas wrote:
> > Log Message:
> > drop __predict micro optimization in pool_init for cleaner code.
> 
> This change should be backed out.  __predict_{true,false} are not only micro 
> optimizations, they also document behavior of the program.

I see this differently. Documentation is done by writing comments or
chosing speaking object names. __predict is a hint to the compiler
that some result is more likely than the other but not that 'cold'
is true exactly during early initialization and never again after
that phase completed. The name 'cold' already does this.

If the code needs clarification, then about the fact that pools
are used before the pool subsystem (in particular the locks)
are initialized and 'cold' is queried as a crude workaround.

> For machine with small icaches, the use of the __predict_* macros can make a 
> significant difference

Not for code paths that are called only a few dozen times. Readability wins
against theoretical performance benefits.

Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index