unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* performance of converting alist to hash table
@ 2004-05-16  9:55 Dai Yuwen
  2004-05-16 10:13 ` Thien-Thi Nguyen
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Dai Yuwen @ 2004-05-16  9:55 UTC (permalink / raw)


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

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-05-26 23:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-16  9:55 performance of converting alist to hash table Dai Yuwen
2004-05-16 10:13 ` Thien-Thi Nguyen
2004-05-16 12:35   ` Dai Yuwen
2004-05-16 11:18 ` Eli Zaretskii
2004-05-16 12:14   ` Dai Yuwen
2004-05-16 14:02     ` Andreas Schwab
2004-05-16 15:51       ` Adrian Aichner
2004-05-17  1:18       ` Dai Yuwen
2004-05-17 17:43 ` Ted Zlatanov
2004-05-17 23:37   ` Miles Bader
2004-05-18 11:50     ` Dai Yuwen
2004-05-18 13:42       ` Stefan Monnier
2004-05-19 11:59         ` Dai Yuwen
2004-05-19 23:27           ` Kenichi Handa
2004-05-26 13:29             ` Dai Yuwen
2004-05-26 23:21               ` Kenichi Handa
2004-05-18 12:23 ` David Kastrup
2004-05-19 12:02   ` Dai Yuwen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).