[ create a new paste ] login | about

Link: http://codepad.org/KIwXHPCx    [ raw code | fork ]

PHP, pasted on Jan 24:
<?php
$memcached_server = 'X.X.X.X';

// Bazaar issue:
// If loop is set to 500 the q array takes ~90ms and the a array takes ~2ms
$loop = 500;

// If loop is set to 800 the q array takes ~5ms and the a array takes ~90ms
//$loop = 900;

// If loop is set to 650 the q array takes ~5ms and the a array takes ~5ms
//$loop = 650;

$m = new Memcached();
$m->addServer($memcached_server, 11211);

$a = array();
$q = array();

for($i = 0; $i <= $loop; $i++) {
	$a[] = '1';
	$q[] = '1';
	$q[] = '1';
	$q[] = '1';
}
$m->set('test',$a);
$m->set('test1',$q);

$timer_rcache = microtime(true);
$result = $m->get('test');
echo 'a : ' . round(1000*(microtime(true) - $timer_rcache),2) . '(ms)<br/>';

$timer_rcache = microtime(true);
$result = $m->get('test1');
echo 'q : ' .  round(1000*(microtime(true) - $timer_rcache),2) . '(ms)<br/>';


Create a new paste based on this one


Comments: