php, python, perl, again.
Tres Seaver
tseaver at palladion.com
Fri Jun 30 18:10:44 UTC 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brian Moon wrote:
> http://dealnews.com/developers/memcachedv2.html
>
> I ran more tests and put more info up there about my config. All you
> mod_perl and mod_python gurus, don't laugh at me unless you are willing
> to send me a better config. In fact, please do and I will retest if you
> think it will change the tests.
>
> This time I included the rewritten Perl client. To whoever wrote that,
> can you look at this, the tests and the config and tell me where I may
> have went wrong with it. From the past discussion, I thought it would
> be much faster than the current Perl client.
>
The following patch makes the 'sets-gets' Python script faster by around
20% faster (the actual working parts, not all the mod_python plumbing)
on my machine (a version which bails out after the 'gets' loop runs at
14.7 ms, versus 18.2 in the original, according to Python's timeit.py):
- --- sets-gets.py.orig 2006-06-30 13:56:59.000000000 -0400
+++ sets-gets.py 2006-06-30 14:06:57.000000000 -0400
@@ -6,14 +6,13 @@
def handler(req):
- - for i in range(100):
- - key = "thing" + str(i)
- - rc = mc.set(key, i)
+ keys = [('key%s' % x, 1) for x in range(100)]
+ for key, i in keys:
+ rc = mc.set(key, i)
- - for i in range(100):
- - key = "thing" + str(i)
- - rc = mc.get(key)
- -
- - req.content_type = "text/html"
- - req.write("")
- - return apache.OK
+ for key, i in keys:
+ rc = mc.get(key)
+
+ req.content_type = "text/html"
+ req.write("")
+ return apache.OK
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEpWkj+gerLs4ltQ4RArZwAJ9dyaEbJBDu+culk2ysP6vONh38IQCfZG8u
/vp+qBWB815k36Wk8vQLYl8=
=s5p9
-----END PGP SIGNATURE-----
More information about the memcached
mailing list