RE: [PHP-DEV] messing with branch prediction

From: Date: Tue, 20 Jun 2006 09:44:10 +0000
Subject: RE: [PHP-DEV] messing with branch prediction
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-24159@lists.php.net to get a copy of this message
> Instead of guessing branch probabilities, why not measure them? Or, simply tell the compiler what you expect. Sometimes, GCC predicts incorrectly - if-branches are usually assumed _not_ to be executed. if (expect_true(x)) { foo(); } with.. #ifdef HAVE_BUILTIN_EXPECT # define expect_true(x) __builtin_expect((x), 1) # define expect_false(x) __builtin_expect((x), 0) #else # define expect_true(x) (x) # define expect_false(x) (x) #endif - Sascha

« previous php.internals (#24159) next »