emacs-devel
[Top][All Lists]
Advanced

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

performance of converting alist to hash table


From: Dai Yuwen
Subject: performance of converting alist to hash table
Date: Sun, 16 May 2004 09:55:22 +0000
User-agent: Mutt/1.4.2.1i

Dear all,

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. 

This is the function:

(defun convert-alist-to-hash (table  w)
  (let ((l w))
     (while l
       (setq char (car (car l))
             key (car (cdr (car l)))
             l (cdr l))
       (puthash char key table))))

And how I call the function:

(convert-alist-to-hash ta 
'(("w1" "aaaa")
("w2" "aa")
("w3" "aak")
...))

I once tried to write the above function as a macro since the alist is
known at compiling time so that most work will be done at compiling
time instead of runing time, but failed. Any idea? Thanks in advance.

Best regards,
Dai Yuwen

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




reply via email to

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