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: Tue, 18 May 2004 11:50:30 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040518115030.GA21952@SDF.LONESTAR.ORG> References: <20040516095522.GA1625@SDF.LONESTAR.ORG> <4n3c5zj6eq.fsf@lifelogs.com> <20040517233743.GA11854@fencepost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1084882417 20189 80.91.224.253 (18 May 2004 12:13:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 May 2004 12:13:37 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue May 18 14:13:28 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 1BQ3TM-0006Oe-00 for ; Tue, 18 May 2004 14:13: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 1BQ3TL-00015o-00 for ; Tue, 18 May 2004 14:13:28 +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 1BQ3NR-00072B-Km for emacs-devel@quimby.gnus.org; Tue, 18 May 2004 08:07:21 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BQ3K2-0006ex-Up for emacs-devel@gnu.org; Tue, 18 May 2004 08:03:51 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BQ3GI-0006P4-E7 for emacs-devel@gnu.org; Tue, 18 May 2004 08:00:44 -0400 Original-Received: from [192.94.73.20] (helo=sdf.lonestar.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BQ37F-0004wE-Ah for emacs-devel@gnu.org; Tue, 18 May 2004 07:50:37 -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 i4IBoUTO016242 for ; Tue, 18 May 2004 11:50:30 GMT Original-Received: (from daiyuwen@localhost) by sdf.lonestar.org (8.12.10/8.12.8/Submit) id i4IBoUA2025646 for emacs-devel@gnu.org; Tue, 18 May 2004 11:50:30 GMT Original-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <20040517233743.GA11854@fencepost> 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:23623 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23623 On Mon, May 17, 2004 at 07:37:43PM -0400, Miles Bader wrote: > On Mon, May 17, 2004 at 01:43:41PM -0400, Ted Zlatanov wrote: > > Maybe the equality test you are using is too slow? > > I think that's a good point -- specifying _any_ non-standard :test function > (that is, anything except eq/eql/equal) probably slows down hashing quite a > bit. > I use equal as the test function: (setq ta (make-hash-table :test 'equal :size 7000)) But I forgot to mention: the key of hash is a Chinese GB2312 string. Does this slow down hashing? I decide to give up using hash. After all alist behaves like hash. All I need is a function like gethash: (defun get-value (key) (cadr (assoc key alist))) I profiled get-value and gethash, the result is acceptable, though get-value is slower. Best regards, Dai Yuwen