home ‣ Benchmarking php code fragments

15 Jan 2006 · Tags: php ← newer • 193 of 587older →

Here's how to do it:

function getmicrotime()
{
        $t = microtime();
        $t = explode(' ',$t);
        return (float)$t[1]+ (float)$t[0];
}

function dobench1($ITER)
{
        bench1();
        $t1 = getmicrotime();
        for ($i=$ITER; --$i >= 0;) {
                bench1();
        }
        return getmicrotime() - $t1;
}

blog comments powered by Disqus