[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
About performance, hash-tables and garbage collection
From: |
Oliver Scholz |
Subject: |
About performance, hash-tables and garbage collection |
Date: |
Fri, 20 Sep 2002 19:06:38 +0200 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu) |
I am currently writing a library in which the main function has an
inner loop that may run several thousand times. So I care a bit about
the performance of this inner loop.
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))))
2. I noticed that the garbage collector hits in a little bit too
often, though I do not know why. I have a lot of `setq'-statements
like `(setq pointer (1+ pointer))'. Is it possible that they are
the cause? If so, what could I do?
-- Oliver
--
Jour de la Raison de l'Année 210 de la Révolution
Liberté, Egalité, Fraternité!
- About performance, hash-tables and garbage collection,
Oliver Scholz <=