From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: About performance, hash-tables and garbage collection Date: Sat, 21 Sep 2002 01:09:13 +0200 Organization: Olymp Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <5lfzw4nzdx.fsf@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1032607612 19506 127.0.0.1 (21 Sep 2002 11:26:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 21 Sep 2002 11:26:52 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17siPI-00053q-00 for ; Sat, 21 Sep 2002 13:26:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17siOP-0006Gt-00; Sat, 21 Sep 2002 07:25:45 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-205-145.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: dialin-145-254-205-145.arcor-ip.net (145.254.205.145) Original-X-Trace: fu-berlin.de 1032596464 6173887 145.254.205.145 (16 [87814]) X-Orig-Path: hermes!nobody X-Operating-System: Linux from Scratch X-Attribution: os X-Face: "HgH2sgK|bfH$;PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6;Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu) Cancel-Lock: sha1:uh6SyXh7lmC4vr4Xfj+FpdDmGVA= Original-Xref: nntp.stanford.edu gnu.emacs.help:105129 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1684 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1684 "Stefan Monnier " writes: >> 1. I have read that hash-tables have a little overhead and that >> association lists are a little bit faster, when they contain not >> more than about a dozen of key-value pairs. It is _possible_ that I >> have to maintain several hundreds or thousand of key/value pairs, >> but in most cases it will be only a dozen or so. So my question is: >> how much overhead has a hashtable? Makes it sense to add a >> condition, like this: >> (if (> ncolours 15) >> (gethash colour colour-map) >> (cdr (assoc (colour colour-map)))) > > The `if' overhead will probably dwarf the difference, so I'd say, > just use the hash-table. Most likely any performance problem you'll have > won't come from that anyway. Thank you. That helps. >> 2. I noticed that the garbage collector hits in a little bit too often, > > What's too often ? Why do you care ? [...] Well, I changed my mind. The ugliness/performance ratio of any attempt to squeeze a little bit more out of that inner loop is very likely too bad. So I do not care about a few garbage collections anymore. -- Oliver -- Jour des Récompenses de l'Année 210 de la Révolution Liberté, Egalité, Fraternité!