Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 54969 invoked from network); 17 Apr 2004 16:48:58 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 17 Apr 2004 16:48:58 -0000 Received: (qmail 52720 invoked by uid 500); 17 Apr 2004 16:48:49 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 52691 invoked by uid 500); 17 Apr 2004 16:48:49 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 52674 invoked from network); 17 Apr 2004 16:48:49 -0000 Message-ID: <20040417164851.52475.qmail@web25202.mail.ukl.yahoo.com> Date: Sat, 17 Apr 2004 17:48:51 +0100 (BST) From: =?iso-8859-1?q?Ami=20Ganguli?= Subject: Re: precalculating hash values for apr_hash_t To: rbb@rkbloom.net Cc: dev@apr.apache.org In-Reply-To: <1082222101.408166157c8bf@webmail.mydomain.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --- rbb@rkbloom.net wrote: > > How are you computing your pre-computed hash values? > Did you copy the hashing > algorithm from APR's find_entry? Yup. > My biggest concern with this function is that the > caller's hash function must > agree with APR's hash function or the hash table > won't work. Good point. > A better approach to this, IMHO, is to create a new > apr_hash_make function that > allows a user to pass in a hash function. This way, > your program could > pre-compute and cache the hash values. When > apr_hash_set or apr_hash_get are > called, they will call your hashing function, which > could then retrieve the > correct value from the hash. In fact, that would work quite nicely. I'll work up a patch. ... Ami. ____________________________________________________________ Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html