note 72626 deleted from function.min by nlopess

From: Date: Fri, 26 Jan 2007 16:53:20 +0000
Subject: note 72626 deleted from function.min by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122237@lists.php.net to get a copy of this message
Note Submitter: ahigerd at stratitec dot com ---- nonick AT 8027 DOT org commented that min() is slower than using the ternary operator, but if you've researched performance of the ternary operator in PHP before, you'll actually know that you can go a step faster: (these tests are on 1,000,000 iterations) $a = min($b, $c); // 0.837 sec $a = ($b < $c) ? $b : $c; // 0.411 sec if($b < $c) $a = $b; else $a = $c; // 0.374 sec PHP exhibits the strange behavior that shorter code often performs SLOWER than longer code.

« previous php.notes (#122237) next »