Gemstone/S 3.4.0 Speed comparision – SortedCollection against IdentitySet

In one of my application I used a SortedCollection and this container might carry in the beginning a large number of items. I’m now interested, if one could get a faster solution with IdentitySet together with Index support. The results presented below include the transaction duration and should be only read  as an indication how…

In one of my application I used a SortedCollection and this container might carry in the beginning a large number of items. I’m now interested, if one could get a faster solution with IdentitySet together with Index support.

The results presented below include the transaction duration and should be only read  as an indication how the container behave in different situation.

So I compare four different cases:

  • Sort – SortedCollection
    • via SortedCollection sortBlock: [ :a :b | a numValue < b numValue ])
  • Set – IdentitySet with Index support
    • createEqualityIndexOn: ‘numValue’ withLastElementClass: Integer options: GsIndexOptions btreePlusIndex + GsIndexOptions optimizedComparison.
  • RcSet – IdentitySet with reduced confilict index support
    • createEqualityIndexOn: ‘numValue’ withLastElementClass: Integer options: GsIndexOptions btreePlusIndex + GsIndexOptions optimizedComparison + GsIndexOptions reducedConflict.
  • LegacySet – IdentitySet with LegacySupport
    • createEqualityIndexOn: ‘numValue’ withLastElementClass: Integer options: GsIndexOptions legacyIndex .

Insert

In the first test case I added 100.000 items with random integer values to the container and repeated this 10 times (The values for the lower lines are around 3800ms).

RemoveFirst

In the second test case I removed 100.000 times the first item of the container and repeated this 10 times (The values for the lower lines are around 3800ms).

RemoveLast

In the third test case I removed 100.000 times the last item of the container and repeated this 10 times.

So as a summary in general IdentitySet with index support is faster than SortedCollection, with one exception: if your application removes the item only from the end – your application might be up to 100 times faster than when using IdentitySet.

In the last case (by the way) the number for SortedCollection were around 40ms)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.