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: Mon, 17 May 2004 01:18:03 +0000
User-agent: Mutt/1.4.2.1i

On Sun, May 16, 2004 at 04:02:00PM +0200, Andreas Schwab wrote:
> Dai Yuwen <address@hidden> writes:
> 
> > I use `mapc' like this:
> > (defun convert-alist-to-hash (table  w)
> >   (mapc (lambda (e)
> >           (puthash (car e) (cadr e) table))
> >         w))
> >
> > Almost the same time needed. (I made a mistake in the previous email, it 
> > should be 30 seconds instead of 15.) 
> 
> How did you create the hash table?  You should probably start with a
> larger hash table than the default to avoid too many resize operations.
> 
I realized this. I created the hash table like this:
(setq ta (make-hash-table :test 'equal :size 7000))

and the actuaal length of the alist is 6727.

> Andreas.
> 
> -- 
> Andreas Schwab, SuSE Labs, address@hidden
> SuSE Linux AG, Maxfeldstra?e 5, 90409 N?rnberg, Germany
> Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

-- 
address@hidden
SDF Public Access UNIX System - http://sdf.lonestar.org




reply via email to

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