[Top][All Lists]

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

Re: [Chicken-users] Does Chicken garbage collect unreferenced symbols?

From: Andrew Reilly
Subject: Re: [Chicken-users] Does Chicken garbage collect unreferenced symbols?
Date: Mon, 24 Aug 2009 16:41:52 +1000
User-agent: Mutt/

On Sun, Aug 23, 2009 at 05:38:10PM -0400, John Cowan wrote:
> Alaric Snell-Pym scripsit:
> > Is that necessarily the best solution to your problem, though?
> > Anything with an identity (a cons cell, for example) will work as a
> > 'token' for a-list lookups?
> The idea is to speed up string lookups.  Currently the a-list maps strings
> to values, which means I must use assoc to search it.  If it mapped
> symbols to values instead, I could use the faster assq.  I'd rather intern
> the strings once and have done, but I don't want to cause a memory leak.

If you're going to have a *lot* of these strings (and you are,
or you wouldn't be worried about the GC angle), then you could
be better off with a "real" hash table or r/b-tree or similar
structure.  Even with the assoc -> assq conversion your search
is still O(N), when it could be O(logN) or O(1).




reply via email to

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