You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/03/21 13:15:52 UTC

[Bug 56297] New: Attempted optimisation does not (improve performance)

https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

            Bug ID: 56297
           Summary: Attempted optimisation does not (improve performance)
           Product: Tomcat Connectors
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_jk
          Assignee: dev@tomcat.apache.org
          Reporter: apache@xenoc.demon.co.uk

Added Nov-2004 in JK 1.2.7 the COMPUTE_KEY_CHECKSUM macro 
is an attempt to allow us to check if we can skip a strcmp() invocation
but the key generated is always the same 
as all 'names' in mod_jk start with the same four characters ('work' - from
'worker.') so it does not improve performance.

http://svn.apache.org/viewvc?view=revision&revision=299957

It can be changed to a digest to get the desired performance gain.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56297] Attempted optimisation does not (improve performance)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

Thomas Schodt <ap...@xenoc.demon.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |1.2.37

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56297] Attempted optimisation does not (improve performance)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

--- Comment #1 from Thomas Schodt <ap...@xenoc.demon.co.uk> ---
Patch tested on linux.

$ svn diff jk_map.c
Index: jk_map.c
===================================================================
--- jk_map.c    (revision 1579918)
+++ jk_map.c    (working copy)
@@ -36,8 +36,8 @@
 #define JK_MAP_REFERENCE    (".reference")
 #define JK_MAP_REFERENCE_SZ (strlen(JK_MAP_REFERENCE))

-/* Compute the "checksum" for a key, consisting of the first
- * 4 bytes, packed into an int.
+/* Compute the "checksum" for a key, consisting of
+ * a digest of the string (same as java hashcode).
  * This checksum allows us to do a single integer
  * comparison as a fast check to determine whether we can
  * skip a strcmp
@@ -45,23 +45,13 @@
 #define COMPUTE_KEY_CHECKSUM(key, checksum)    \
 {                                              \
     const char *k = (key);                     \
-    unsigned int c = (unsigned int)*k;         \
-    (checksum) = c;                            \
-    (checksum) <<= 8;                          \
-    if (c) {                                   \
-        c = (unsigned int)*++k;                \
-        checksum |= c;                         \
+    (checksum) = 0;                            \
+    unsigned int c = (unsigned int)*k++;       \
+    while(c) {                                 \
+        (checksum) *= 31;                      \
+        (checksum) += c;                       \
+        c = (unsigned int)*k++;                \
     }                                          \
-    (checksum) <<= 8;                          \
-    if (c) {                                   \
-        c = (unsigned int)*++k;                \
-        checksum |= c;                         \
-    }                                          \
-    (checksum) <<= 8;                          \
-    if (c) {                                   \
-        c = (unsigned int)*++k;                \
-        checksum |= c;                         \
-    }                                          \
 }

 static volatile int global_map_id = 0;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56297] Attempted optimisation does not (improve performance)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

--- Comment #2 from Rainer Jung <ra...@kippdata.de> ---
Thanks for the suggestion. I have taken a very similar code from the APR libs.
Fixed in r1583403. Will be part of 1.2.40.
Would be nice if you could give that change a try.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56297] Attempted optimisation does not (improve performance)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

Rainer Jung <ra...@kippdata.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org