help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About performance, hash-tables and garbage collection


From: Oliver Scholz
Subject: Re: About performance, hash-tables and garbage collection
Date: Sat, 21 Sep 2002 01:09:13 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

"Stefan Monnier <address@hidden>" 
<monnier+gnu.emacs.help/news/@flint.cs.yale.edu> 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é!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]