Skip to content

Instantly share code, notes, and snippets.

@abhi-bit
Created January 20, 2015 08:48
Show Gist options
  • Save abhi-bit/afda95891ac46b3009ed to your computer and use it in GitHub Desktop.
Save abhi-bit/afda95891ac46b3009ed to your computer and use it in GitHub Desktop.
<?php
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$starttime = microtime_float();
$cb = new Couchbase("10.4.2.115:8091", "","","default", false);
$cb->set(uniqid('php_'), 1);
$endtime = microtime_float();
$total_time = ($endtime - $starttime);
echo 'Total time for conn and set: '.$total_time.' secs';
echo "\n";
$i = 0;
for($i = 0; $i <= 100 ; $i++)
{
$starttime = microtime_float();
$cb->set(uniqid('php_'), 1);
$endtime = microtime_float();
$total_time = ($endtime - $starttime);
echo 'Total time taken for'.$i.' set: '.$total_time.' secs';
echo "\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment