diff options
author | Christophe Jaillet <jailletc36@apache.org> | 2013-01-06 18:52:43 +0100 |
---|---|---|
committer | Christophe Jaillet <jailletc36@apache.org> | 2013-01-06 18:52:43 +0100 |
commit | 67246c45cdf1e4f62a642897ecbe983a448e3edd (patch) | |
tree | 2a43eade5fcfac6c4e97230bd1677fc9ad49e444 /modules | |
parent | Security notes about SQL injection. (diff) | |
download | apache2-67246c45cdf1e4f62a642897ecbe983a448e3edd.tar.xz apache2-67246c45cdf1e4f62a642897ecbe983a448e3edd.zip |
According top my testing 'socache_mc_id2key' is 6x faster with the use 'ap_bin2hex' instead of
apr_snprintf(..., "%02X" for each character.
Output is *not* exactly the same. It was uppercase, now it is lowercase.
According to my understanding, this is not an issue.
Should it be, a call to ap_str_toupper should be added.
The speedup would be less, but still significant.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1429561 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cache/mod_socache_memcache.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/modules/cache/mod_socache_memcache.c b/modules/cache/mod_socache_memcache.c index ccb1bde766..beeeec2c98 100644 --- a/modules/cache/mod_socache_memcache.c +++ b/modules/cache/mod_socache_memcache.c @@ -182,19 +182,13 @@ static int socache_mc_id2key(ap_socache_instance_t *ctx, char *key, apr_size_t keylen) { char *cp; - unsigned int n; if (idlen * 2 + ctx->taglen >= keylen) return 1; cp = apr_cpystrn(key, ctx->tag, ctx->taglen); + ap_bin2hex(id, idlen, cp); - for (n = 0; n < idlen; n++) { - apr_snprintf(cp, 3, "%02X", (unsigned) id[n]); - cp += 2; - } - - *cp = '\0'; return 0; } |