unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: About performance, hash-tables and garbage collection
Date: Sat, 21 Sep 2002 01:09:13 +0200	[thread overview]
Message-ID: <m3fzw46yxy.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: 5lfzw4nzdx.fsf@rum.cs.yale.edu

"Stefan Monnier <foo@acm.com>" <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	other threads:[~2002-09-20 23:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-20 17:06 About performance, hash-tables and garbage collection Oliver Scholz
2002-09-20 21:07 ` Stefan Monnier <foo@acm.com>
2002-09-20 23:09   ` Oliver Scholz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3fzw46yxy.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).