Пример #1
0
{
    list($usec, $sec) = explode(" ", microtime());
    return intval(1000 * ((double) $usec + (double) $sec));
}
# prime anything that can be primed?
for ($i = 0; $i < 100; $i++) {
    try_nq();
    try_qq();
}
#
# do iiiit
#
$num = 10000;
$t1 = microtime_ms();
for ($i = 0; $i < $num; $i++) {
    try_nq();
}
$t2 = microtime_ms();
for ($i = 0; $i < $num; $i++) {
    try_qq();
}
$t3 = microtime_ms();
echo "Time taken to run 8 assignements " . number_format($num) . " times, using 28 key names:<br /><br />\n";
echo "bare-word keys: " . number_format($t2 - $t1) . " ms<br />\n";
echo "quoted keys: " . number_format($t3 - $t2) . " ms<br />\n";
function try_nq()
{
    $a = array();
    $a[b] = array();
    $a[b][c] = array();
    $a[b][c][d] = array();
Пример #2
0
	}



	# prime anything that can be primed?
	for ($i=0; $i<100; $i++){ try_nq(); try_qq(); }


	#
	# do iiiit
	#

	$num = 10000;

	$t1 = microtime_ms();
	for ($i=0; $i<$num; $i++){ try_nq(); }
	$t2 = microtime_ms();
	for ($i=0; $i<$num; $i++){ try_qq(); }
	$t3 = microtime_ms();


	echo "Time taken to run 8 assignements ".number_format($num)." times, using 28 key names:<br /><br />\n";

	echo "bare-word keys: ".number_format($t2-$t1)." ms<br />\n";
	echo "quoted keys: ".number_format($t3-$t2)." ms<br />\n";


	function try_nq(){
		$a = array();
		$a[b] = array();
		$a[b][c] = array();