apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@mappingsoft.com>
Subject RE: [PATCH] optimization for hash tables and pool userdata
Date Wed, 21 Nov 2001 21:45:28 GMT


> -----Original Message-----
> From: Ian Holsman [mailto:ianh@cnet.com]
> Sent: Wednesday, November 21, 2001 6:03 PM
> To: Brian Pane
> Cc: dev@apr.apache.org
> Subject: Re: [PATCH] optimization for hash tables and pool userdata
> 
> 
> On Sat, 2001-11-17 at 23:35, Brian Pane wrote:
> > This patch speeds up the apr_hash_t implementation's
> > handling of APR_HASH_KEY_STRING.
> > 
> > Index: srclib/apr/tables/apr_hash.c
> > +    if (klen == APR_HASH_KEY_STRING) {
> > +        for (p = key; *p; p++) {
> > +            hash = hash * 33 + *p;
> > +        }
> > +        klen = p - (const unsigned char *)key;
> > +    }

How about to add here something like:
(in apr_hash.h add #define APR_HASH_KEY_UCASE     (-2)

+    else if (klen == APR_HASH_KEY_UCASE) {
+        for (p = key; *p; p++) {
+            hash = hash * 33 + apr_tolower(*p);
+        }
+        klen = p - (const unsigned char *)key;
+    }

that will give you the case insensitive hash table


> > +    else {
> > +        for (p = key, i = klen; i; i--, p++) {
> > +            hash = hash * 33 + *p;
> > +        }
> > +    }


Mime
View raw message