Re: [patch] error masks

From: Date: Mon, 24 Aug 2009 22:12:36 +0000
Subject: Re: [patch] error masks
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-45367@lists.php.net to get a copy of this message
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. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#45367) next »