note 102543 modified in language.operators.errorcontrol by danbrown
| From: | danbrown@php.net | Date: | Mon, 21 Feb 2011 15:02:39 +0000 |
| Subject: | note 102543 modified in language.operators.errorcontrol by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177184@lists.php.net to get a copy of this message | ||
If you're wondering what the performance impact of using the @ operator is, consider this
example. Here, the second script (using the @ operator) takes 1.75x as long to execute...almost
double the time of the first script.
So while yes, there is some overhead, per iteration, we see that the @ operator added only .005 ms
per call. Not reason enough, imho, to avoid using the @ operator.
<?php
function x() { }
for ($i = 0; $i < 1000000; $i++) { x(); }
?>
real 0m7.617s
user 0m6.788s
sys 0m0.792s
vs
<?php
function x() { }
for ($i = 0; $i < 1000000; $i++) { @x(); }
?>
real 0m13.333s
user 0m12.437s
sys 0m0.836s
--was--
If you're wondering what the performance impact of using the @ operator is, consider this
example. Here, the second script (using the @ operator) takes 1.75x as long to execute...almost
double the time of the first script.
So while yes, there is some overhead, per iteration, we see that the @ operator added only .005 ms
per call. Not reason enough, imho, to avoid using the @ operator.
<?php
function x() { }
for ($i = 0; $i < 1000000; $i++) { x(); }
real 0m7.617s
user 0m6.788s
sys 0m0.792s
vs
<?php
function x() { }
for ($i = 0; $i < 1000000; $i++) { @x(); }
real 0m13.333s
user 0m12.437s
sys 0m0.836s
http://php.net/manual/en/language.operators.errorcontrol.php