Submitted by bao on Sun, 11/15/2009 - 01:36
I think you have already known that require/include is faster than require_once/include_one. But sometime, we also need the functionality of require_once but do not suffer from the performance tradeoff. So here is a better way to re-invent PHP implement.
function requireOnce($file)
{
static $dict=array();
if (!isset($dict[$file]))
{
require $file;
$dict[$file] = true;
}
}
Submitted by bao on Thu, 11/05/2009 - 13:20
I have been playing with PHP minor optimization for a while, but this is the first time I go for it seriously. My question for today is what's the best way to work with PHP global variables and how to achieve best performance for it. Rumours say that global keyword is slow, so this is a good time to check it out. And I also want to check if the number of variables affects the performance of the method.
Setup
Submitted by bao on Wed, 01/07/2009 - 12:58