xslib-memcached
xslib-memcached copied to clipboard
So slow
The code is working very slow.
Benchmark information sey: 100 SET iteration at ~3.959
If join code on line 216 and 218 to 1 query
$this->WriteLine($Op . ' ' . $Key . ' 0 ' . $TTL . ' ' . strlen($Value)."\r\n".$Value);
execute time for 100 SET iteration at ~0.0054
and 10500 iteration at ~1 sec
Example benchmark
if(!$m = xsMemcached::Connect('localhost', 21201))
{
die('Failed to connect. This is where you should handle errors gracefully.');
}
$benchmark = microtime(true);
for($i=0;$i<100;$i++)
$m->Set('foo', 'bar');
echo microtime(true) - $benchmark;
Hi, thanks for trying out the code!
I will try the patch you mentioned, when I get the time, and see if there are any consequences to that. If there isn't, I will patch it. At first look your suggestion seems sound and makes me wonder why didn't I think of it.. :)
I think some amount of slowness is to be expected though, because the client is written with pure PHP code, and thus is bound to be a few orders of a magnitude slower than a compiled PHP extension.
Thanks!
I try see how construction have phpredis C extension, meybe can rewrite to memcachedb. But i have 1 problem, i don`t konw C language =)
As Ukrainians say - where we did not disappear