memcache vs memcached - сравниваем клиенты для PHP

<?php
$ops = 10000;
$m = new Memcache();
$m->addServer('localhost');
$md = new Memcached();
$md->addServer('localhost', 11211);
echo "Test operations: {$ops}";
echo "<h3>set test</h3>";
$keys = array();
for ( $i = 0; $i < $ops; $i++ ) $keys[md5(rand(1000, 99999))] = $i;
$s = microtime(true);
foreach ($keys as $key => $value ) $m->set($key, $value);
echo "Memcache: " . ($res['memcache']['get'] = microtime(true) - $s ) . "<br />";
$s = microtime(true);
foreach ($keys as $key => $value ) $md->set($key, $value);
echo "Memcached: " . ($res['memcached']['get'] = microtime(true) - $s ) . "<br />";
echo "<h3>get test</h3>";
$s = microtime(true);
foreach ($keys as $key => $value ) $m->get($key);
echo "Memcache: " . ($res['memcache']['set'] = microtime(true) - $s ) . "<br />";
$s = microtime(true);
foreach ($keys as $key => $value ) $md->get($key);
echo "Memcached: " . ($res['memcached']['set'] = microtime(true) - $s ) . "<br />";
echo "<h3>delete test</h3>";
$s = microtime(true);
foreach ($keys as $key => $value ) $m->delete($key);
echo "Memcache: " . ($res['memcache']['delete'] = microtime(true) - $s ) . "<br />";
$s = microtime(true);
foreach ($keys as $key => $value ) $md->delete($key);
echo "Memcached: " . ($res['memcached']['delete'] = microtime(true) - $s ) . "<br />";
echo "<h3>combined test</h3>";
$s = microtime(true);
foreach ($keys as $key => $value )
{
$m->set($key, $value);
$m->get($key);
$m->delete($key);
}
echo "Memcache: " . ($res['memcache']['combined'] = microtime(true) - $s ) . "<br />";
$s = microtime(true);
foreach ($keys as $key => $value )
{
$md->set($key, $value);
$md->get($key);
$md->delete($key);
}
echo "Memcached: " . ($res['memcached']['combined'] = microtime(true) - $s ) . "<br />";