all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: performance of converting alist to hash table
Date: 18 May 2004 14:23:46 +0200	[thread overview]
Message-ID: <x51xlhore5.fsf@lola.goethe.zz> (raw)
In-Reply-To: <20040516095522.GA1625@SDF.LONESTAR.ORG>

Dai Yuwen <daiyuwen@sdf.lonestar.org> writes:

> 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")
> ...))

Did you byte-compile the function?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2004-05-18 12:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2004-05-19 12:02   ` Dai Yuwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x51xlhore5.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.