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: Ted Zlatanov
Subject: Re: performance of converting alist to hash table
Date: Mon, 17 May 2004 13:43:41 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

On Sun, 16 May 2004, address@hidden wrote:

> I'm trying to convert a large alist(nearly 7000 elements in it) to a
> hash table. But I found the performence of my function is poor: on a
> Celeron 333MHz, 196M memory system, it'll take 15 seconds to finish
> converting. 

I use this function in the Gnus gnus-registry.el code:

(defun alist-to-hashtable (alist)
  "Build a hashtable from the values in ALIST."
  (let ((ht (make-hash-table                        
             :size 4096
             :test 'equal)))
    (mapc
     (lambda (kv-pair)
       (puthash (car kv-pair) (cdr kv-pair) ht))
     alist)
     ht))

It loads my 5000-entry registry alist quickly even on a relatively
slow (UltraSPARC-IIe 650 MHz) processor.  Is it slow for you?  Maybe
the equality test you are using is too slow?

Ted





reply via email to

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