/OSetBenchmarks

Benchmarks for OSet

Primary LanguageSwift

Benchmarks sources and results for OSet.

Testing Machine: MacBook M1 Pro 10-core. Swift version used: 5.8.

Goal: Subsecond timings for all of the following.

  • Insert an element into OSet of 2.000.000 entries.
  • Update an element in OSet of 2.000.000 entries.
  • Remove an element from OSet of 2.000.000 entries.
  • Check that OSet of 2.000.000 entries contains an element.
  • Union two OSets of 100.000 entries each.
  • Intersection of two OSets of 100.000 entries each.
  • Subtracting two OSets of 100.000 entries each.
  • Symmetric Difference of two OSets of 100.000 entries each.
  • Iteration over an OSet of 100.000 entries.

Other than that, comparison benchmarks were performed against stdlib Array and Set (as reference) and three other Ordered Set implementations found, Bradhilton, Weebly and Turbolent.

Due to some operations being very slow, to prevent comparison benchmarking from taking hours (literally) and producing almost unreadable results, some operations were stepped down in number of entries to 2.000. Said operations are: Union, Intersection, Symmetric Difference and Subtracting.

Run it yourself

Run benchmarks alone with ./mk.

Creating charts requires nodejs >= 16. Do it with npm install, then ./chart.js.

OSet Results

OSetOnlyBenchmarks

Comparison Results

Init

Init

Insert

Insert

Update

Update

Remove

Remove

Contains

Contains

Union

Union

Intersection

Intersection

Subtracting

Subtracting

Symmetric Difference

SymmetricDifference

Iteration

Iteration