On Sun, 30 Mar 2003 14:06:29 -0500 "Mike Robinson" <[EMAIL PROTECTED]> wrote:
> Andrei Zmievski wrote: > > > > On Sun, 30 Mar 2003, Mike Robinson wrote: > > > ATM, in_array() takes 2 args and 1 parameter. Adding 1 more > > > wouldn't hurt, doesn't break BC, and provides some added > > > usefulness. > > > > And slows down the inner loop of searching. > > Indeed, but it's always a point of contention; the tradeoffs > between performance and feature set. Seems to me that in_array() > no matter was is going to be a bit of a performance hound, so > adding some usefulness isn't going to be that much of a headache. > But if in your opinion the tradeoff is too profound leave it > out, by all means. My point was that of usefulness. I'll leave > the weighting against performance of such to the experts. I had to make a test with and without any of my patches.. novell TESTS # ./performance_test.php Test took: 20.615808010101 seconds novell TESTS # ./performance_test.php Test took: 20.806298971176 seconds novell TESTS # uptime 22:07:58 up 7:24, 1 user, load average: 1.19, 1.05, 1.08 First run is with patches, and second one without patches. The script is: #!/tmp/php5test/bin/php <?php function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); $array = array(1 => "test", 2 => "temp", 3 => "typo", 4 => "magnus", 5 => "loss", 6 => "luser", 7 => "is", 8 => "sending", 9 => "me", 10 => "wedding", 11 => "pics", 12 => "throu", 13 => "IRC", 14 => "performance", 15 => "loss", 16 => "must", 17 => "check", 18 => "if", 19 => "its", 20 => "bad"); for ($x = 0; $x < 500000; $x++) { in_array("doesnt_exist", $array); } $time_end = getmicrotime(); $time = $time_end - $time_start; echo "Test took: $time seconds\n"; ?> PHP was compiled with: ./configure --disable-all --enable-cli --disable-cgi --with-pcre-regex --prefix=/tmp/php5test As I understand, the concern of performance loss would be that it would need to check more stuff in the loops before it could proceed. /Magnus -- To do two things at once is to do neither. -- Publilius Syrus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php