]> granicus.if.org Git - apache/commitdiff
Merge r1429561 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 11 Mar 2013 16:32:55 +0000 (16:32 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 11 Mar 2013 16:32:55 +0000 (16:32 +0000)
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.
Submitted by: jailletc36
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1455220 13f79535-47bb-0310-9956-ffa450edef68

STATUS
modules/cache/mod_socache_memcache.c

diff --git a/STATUS b/STATUS
index 2944a5322e169f44368c798ca90d2115f22937bd..acce76c5126023ca306e4054bcf170b9c8208a5e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -117,13 +117,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.4.x cumulative patch: http://people.apache.org/~jailletc36/backport5.patch (minus CHANGES for 1448171)
     +1: jailletc36, igalic, jim
 
-  * mod_socache_memcache: speed up key generation by x6 using ap_bin2hex intoduced in 2.4.4
-    Generated keys will be in lowercase instead of uppercase, so it will trash the cache. I don't think
-    this is a real issue.
-    trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1429561
-    2.4.x patch: trunk patch applies.
-    +1: jailletc36, humbedooh, jim
-
   * mod_charset_lite: clean up and speed up special case of logging function by x13 using ap_bin2hex intoduced in 2.4.4
     It will be in lowercase instead of uppercase, but it is only for logging. I don't think this is a real issue.
     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1429582
index ccb1bde76684a3facb46650aedca988b5641810f..beeeec2c982e4c5dbe61b5f4fbe56ec946fdc103 100644 (file)
@@ -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;
 }