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: Mon, 17 May 2004 01:18:03 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040517011803.GA22422@SDF.LONESTAR.ORG> References: <20040516095522.GA1625@SDF.LONESTAR.ORG> <20040516121431.GA29093@SDF.LONESTAR.ORG> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1084757006 28621 80.91.224.253 (17 May 2004 01:23:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 May 2004 01:23:26 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 17 03:23:16 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 1BPWqa-0004vb-00 for ; Mon, 17 May 2004 03:23:16 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPWqa-0003Ee-00 for ; Mon, 17 May 2004 03:23:16 +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 1BPWmD-0005fa-Kj for emacs-devel@quimby.gnus.org; Sun, 16 May 2004 21:18:45 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BPWm7-0005f0-CE for emacs-devel@gnu.org; Sun, 16 May 2004 21:18:39 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BPWlb-0005ay-AG for emacs-devel@gnu.org; Sun, 16 May 2004 21:18:38 -0400 Original-Received: from [192.94.73.20] (helo=sdf.lonestar.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPWla-0005ai-ID for emacs-devel@gnu.org; Sun, 16 May 2004 21:18:07 -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 i4H1I3XL020609 for ; Mon, 17 May 2004 01:18:03 GMT Original-Received: (from daiyuwen@localhost) by sdf.lonestar.org (8.12.10/8.12.8/Submit) id i4H1I3jW011739 for emacs-devel@gnu.org; Mon, 17 May 2004 01:18:03 GMT Original-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-MIME-Autoconverted: from 8bit to quoted-printable by sdf.lonestar.org id i4H1I3XL020609 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:23561 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23561 On Sun, May 16, 2004 at 04:02:00PM +0200, Andreas Schwab wrote: > Dai Yuwen writes: >=20 > > I use `mapc' like this: > > (defun convert-alist-to-hash (table w) > > (mapc (lambda (e) > > (puthash (car e) (cadr e) table)) > > w)) > > > > Almost the same time needed. (I made a mistake in the previous email,= it should be 30 seconds instead of 15.)=20 >=20 > How did you create the hash table? You should probably start with a > larger hash table than the default to avoid too many resize operations. >=20 I realized this. I created the hash table like this: (setq ta (make-hash-table :test 'equal :size 7000)) and the actuaal length of the alist is 6727. > Andreas. >=20 > --=20 > Andreas Schwab, SuSE Labs, schwab@suse.de > SuSE Linux AG, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany > Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." --=20 daiyuwen@freeshell.org SDF Public Access UNIX System - http://sdf.lonestar.org