From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dai Yuwen Newsgroups: gmane.emacs.devel Subject: Re: performance of converting alist to hash table Date: Wed, 19 May 2004 12:02:02 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040519120202.GB2149@SDF.LONESTAR.ORG> References: <20040516095522.GA1625@SDF.LONESTAR.ORG> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1084983887 8348 80.91.224.253 (19 May 2004 16:24:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 May 2004 16:24:47 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed May 19 18:24:29 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BQTro-0006GU-00 for ; Wed, 19 May 2004 18:24:28 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BQTrn-0002hX-00 for ; Wed, 19 May 2004 18:24:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BQTQb-0000gf-Qo for emacs-devel@quimby.gnus.org; Wed, 19 May 2004 11:56:22 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BQTPv-0000fI-4F for emacs-devel@gnu.org; Wed, 19 May 2004 11:55:39 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BQQoZ-0006Pj-6H for emacs-devel@gnu.org; Wed, 19 May 2004 09:09:31 -0400 Original-Received: from [192.94.73.20] (helo=sdf.lonestar.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BQPm0-0008QF-Be; Wed, 19 May 2004 08:02:13 -0400 Original-Received: from sdf.lonestar.org (IDENT:daiyuwen@sdf.lonestar.org [192.94.73.1]) by sdf.lonestar.org (8.12.10/8.12.10) with ESMTP id i4JC22CI023112; Wed, 19 May 2004 12:02:03 GMT Original-Received: (from daiyuwen@localhost) by sdf.lonestar.org (8.12.10/8.12.8/Submit) id i4JC22lM011615; Wed, 19 May 2004 12:02:02 GMT Original-To: David Kastrup Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23719 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23719 On Tue, May 18, 2004 at 02:23:46PM +0200, David Kastrup wrote: > Dai Yuwen 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? No matter whether I compiled the function or not, the result almost the same. > -- daiyuwen@freeshell.org SDF Public Access UNIX System - http://sdf.lonestar.org