Efficient thread-local shared variables

Klaus D. Witzel klaus.witzel at cobss.com
Tue Oct 24 15:56:35 UTC 2006


Hi Reinout,

on Tue, 24 Oct 2006 16:30:39 +0200, you wrote:
> On Oct 24, 2006, at 12:13 PM, Klaus D. Witzel wrote:
>
>>
>> When you say that insertion/removal is slow, what do you compare that  
>> to: add/remove to/from an OrderedCollection, or just compared to  
>> set/get?
>
> I was comparing to a Dictionary which does add/remove in near constant  
> time.
> In VW a MethodDictionary is implemented as a SortedCollection with the  
> CompiledMethods sorted by the #identityHash value of their selector.

Ah, the price tag of GOF binary search :|

> So inserting/removing involves moving (copying) half of the collection  
> one slot up/down.
>
>>
>> Have you considered alternatives, any comparisions or ideas that you  
>> can share?
>
> No, this was a full blown case of premature optimization, I now have a  
> fast Vocabulary/SearchOrder implementation but haven't progressed to the  
> real meat of implementing a new namespace system yet :-(

I don't know why but the discussion with you "inspired" three new  
operations for my implementation:

- specialization, clones the anonymous class (shares the method dictionary)
- proliferation of name space, locally copies the method dictionary  
("rapidly" doubles it, still shares methods, variables and state)
- proliferation of state, locally clones "un-shares" a variable (and so  
its state)

Smalltalk rules 8-)

/Klaus

> R
> -
>





More information about the Squeak-dev mailing list