emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: performance of converting alist to hash table


From: Dai Yuwen
Subject: Re: performance of converting alist to hash table
Date: Tue, 18 May 2004 11:50:30 +0000
User-agent: Mutt/1.4.2.1i

On Mon, May 17, 2004 at 07:37:43PM -0400, Miles Bader wrote:
> On Mon, May 17, 2004 at 01:43:41PM -0400, Ted Zlatanov wrote:
> > Maybe the equality test you are using is too slow?
> 
> I think that's a good point -- specifying _any_ non-standard :test function
> (that is, anything except eq/eql/equal) probably slows down hashing quite a
> bit.
> 
I use equal as the test function:
(setq ta (make-hash-table :test 'equal :size 7000))

But I forgot to mention: the key of hash is a Chinese GB2312 string. Does this 
slow down hashing?

I decide to give up using hash. After all alist behaves like hash. All I need 
is a function like gethash:
(defun get-value (key)
   (cadr (assoc key alist)))

I profiled get-value and gethash, the result is acceptable, though get-value is 
slower.

Best regards,
Dai Yuwen






reply via email to

[Prev in Thread] Current Thread [Next in Thread]