Well, its not all that good after all, the timing was correct but not fair
(I hadn't noticed a #copyWithoutDuplicates in SequenceableCollection...),
I did a few more comparisons, and its performance is similar to that of a
Set, actually a little better for small sets.
Have a good one.
Ricardo
"Ricardo Nogueira" <
[hidden email]> wrote in message
news:9f2tlf$1ud72$
[hidden email]...
> In implementing a Cache class, I created an interesting data structure:
> (maybe it does already exist in another ST ...)
>
> LinkedDictionary.
> It is a Dictionary subclass with two instance vars: firstAssociation,
> lastAssociation;
> uses a new association class (double-linked Link with key and value).
>
> The best of two worlds - hash access, fast #size, fast #at:put: and fast
> #remove... with efficient #do (also ordered)
> at the cost of two worlds (hash map + double link).
>
> My only timing so far...
>
> keys := Smalltalk keys asOrderedCollection.
>
> Time millisecondsToRun: [keys copyWithoutDuplicates] 257
>
> Time millisecondsToRun: [keys newCopyWithoutDuplicates] 28
>
>
> * newCopyWithoutDuplicates uses LinkedDictionary, but #keyAndValuesDo: is
> now a LinkedList #do:
> * almost 90% discount!
>
> The cache came out as a push_to_front LinkedDictionary.
>
> Get high with smalltalk!
> Ricardo
>
>