From: am at andremeyer dot name
Operating system: Windows XP
PHP version: 5.0.0RC2
PHP Bug Type: Performance problem
Bug description: Disabling assertions does not affect performance
Description:
------------
Disabling assertions in PHP does not affect performance. After testing my
software with assertions, I want to disable assertions. I do this with
ini_set('assert.active', false);
Surprisingly, the assert() statements in my software _still_ consume a
considerable amount of time.
Reproduce code:
---------------
<?php
$doAsserts = array(true, false);
foreach ($doAsserts as $doAssert)
{
ini_set('assert.active', $doAssert); // Turn assertions on/off
$startTime = microtime(true);
for ($i = 0; $i < 1000000; $i++)
assert(is_numeric($i));
$endTime = microtime(1);
$time = $endTime - $startTime;
print "Elapsed time: $time\r\n";
}
?>
Expected result:
----------------
I expect something like:
Elapsed time: 1.3514750003815 // assertions turned on
Elapsed time: 0.4243453254354 // assertions turned off
I expect the elapsed time to decrease when turning assertions off.
Actual result:
--------------
Elapsed time: 1.3480539321899 // assertions turned on
Elapsed time: 1.3210921287537 // assertions turned off
As you can see, when turning assertions off, the elapsed time is nearly
the same. So I have to comment all my assertions in order to achieve a
better peformance.
--
Edit bug report at http://bugs.php.net/?id=28642&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28642&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28642&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28642&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28642&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28642&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28642&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28642&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28642&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28642&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28642&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28642&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28642&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28642&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28642&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28642&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28642&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28642&r=float