LRU cache for ~=

Steven Schveighoffer schveiguy at yahoo.com
Tue Oct 20 07:58:47 PDT 2009


On Tue, 20 Oct 2009 10:37:40 -0400, Robert Jacques <sandford at jhu.edu>  
wrote:

> So you want to synchronize the ~= function? I thought the LRU would be  
> thread local and therefore independent of these issues, as well as being  
> faster. And if the LRU isn't thread-local, then why not make it part of  
> the GC? It would both be more general and much simpler/cleaner to  
> implement.

quoting myself earlier:

On Tue, 20 Oct 2009 09:58:01 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> In response to other's queries about how many LRUs to use, you'd  
> probably want one per heap, and you'd want to lock/not lock based on  
> whether the heap is thread local or not.

You need a locked operation in the case where the heap is shared,  
otherwise, you lose safety.

At the moment all we *have* is a shared heap.  So ~= is a synchronized  
operation until thread-local heaps are available.

I think the only logical place for the LRU is the GC, it makes no sense to  
have a a shared LRU for an unshared GC or vice versa.

-Steve



More information about the Digitalmars-d mailing list