Skip to content

Instantly share code, notes, and snippets.

@muayyad-alsadi
Created May 30, 2013 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muayyad-alsadi/44379c3c5dc58a1a033e to your computer and use it in GitHub Desktop.
Save muayyad-alsadi/44379c3c5dc58a1a033e to your computer and use it in GitHub Desktop.
benchmarking two YiiRedis against PRedis
<?php
class CacheCommand extends CConsoleCommand
{
public function actionBenchmark() {
$t0=microtime(1);
for($i=0;$i<10000;++$i) {
Yii::app()->redis->getClient()->set("mykey1", "10");
}
$delta=microtime(1)-$t0;
echo "YiiRedis delta $delta\n";
$t0=microtime(1);
for($i=0;$i<10000;++$i) {
Yii::app()->redis2->set('mykey2', "10");
}
$delta=microtime(1)-$t0;
echo "Predis delta $delta\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment