On 25.08.2009, at 00:12, Stanislav Malyshev wrote:

Hi!

Lukas, the problem is that all messages, E_STRICT, E_DEPRECATED,
E_NOTICE, whatever, all cause a performance hit even if the
error_reporting level is such that they will never show up anywhere.
That's what this patch is trying to address.  To write optimal code,
they have to be entirely clean of all messages including E_DEPRECATED
and E_STRICT.

BTW "cleaning the messages" won't help with performance problems in many cases. Let's suppose you have a code that tries to open some file and if it exists, do stuff (and if it doesn't it doesn't care):
$fp = @fopen($filename, "r");
if($fp) {
// do stuff
}
Now if you "clean" it, you do something like:
if(is_readable($filename)) {
        $fp = fopen($filename, "r");
        // do stuff
}
(and if you don't want race condition there, you still need the if()). Then is_readable and fopen can still can't be guaranteed to not produce warnings if there are open_basedir restrictions or streams involved or FS could change in the meanitime. But now instead of one FS access, you have two - not much of a speedup.


right .. but it should reduce the chances of such errors occurring. and like i said .. that is obviously not a speed up, but a slow down. but i generally think its wise to encourage people to properly avoid error conditions locally, because otherwise sooner rather than later you will also no longer see the error conditions which you did not try to avoid/handle locally.

regards,
Lukas Kahwe Smith
m...@pooteeweet.org




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to