Categorygithub.com/fireflycons/generic_collections

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Generic Collections

build

Package generic_collections provides generic versions of common collection types. You will find each collection in its own sub-package. The code is based on ideas from other go packages and .NET generic collections.

Collections are optionally thread-safe (see Thread Safety), and optionally use concurrency in some methods (see Concurrency).

Elements of any type may be stored in these collections. Most basic types are supported out the box, whilst custom types will require the developer to provide functions to support the implementation.

Supported Types

The following types are supported directly by this library without a requirement to provide custom functions for hashing (required for HashSet) and comparer (required for all collections).

  • Numeric types - all classes of integer and float.
  • Pointers - Out of the box, the pointers themselves (i.e. the memory address) are compared by value. If you want to compare/hash on what is being pointed to, then you must provide implementations for these operations.
  • string
  • bool
  • time.Time
  • Any type directly castable to one of the above, e.g. time.Duration which is in effect int64.

Anything else e.g. structs require implementation of these functions, or the collection will panic.

Collection Hierarchy

  • Collection
    • Lists
      • SList - A singly linked list
      • DList - A doubly linked list.
    • Stacks
      • Stack - A slice-backed LIFO stack.
    • Queues
      • Queue - A slice-backed FIFO queue.
      • RingBuffer - A slice-backed circular buffer
    • Sets
      • HashSet - An unordered collection of unique items. Implemented as a hash table.
      • OrderedSet - An ordered collection of unique items. Implemented as a red-black tree.

Thread Safety

You have the option of whether or not a collection supports thread safety by way of a constructor option. Thread safety is not enabled by default. Enabling thread safety engages a sync.RWMutex taking the appropriate lock for the type of operation. Some overhead is incurred if thread safety is enabled. . Use the WithThreadSafe() constructor option to enable. See Benchmarks.

stk := stack.New[int](WithThreadSafe[int]())

Concurrency

In a few places within the sub-packages, concurrency may be enabled to improve performance of some operations. Concurrency is not enabled by default. This is currently limited in scope and may be expanded in future versions. Use the WithConcurrent() constructor option to enable. See benchmarks to see where this applies.

Concurrency features only kick in on large collections (currently > 64K elements). For small collections, using concurrency would slow things down due to the overhead involved in managing goroutines.

stk := stack.New[int](WithConcurrent[int]())

Error Handling

Contrary to the more common pattern of returning an error interface as a second argument, I took the decision to panic in case of errors. Common errors include reading from an empty collection, and modifying an underlying collection while an iteration is in progress. If user code is well behaved, then you should be able to avoid these. All collections can be tested for being empty, and many have "Try" versions of methods that return an additional bool on some operations that would panic.

Iteration

All collections are iterable via a common Iterator interface that yields Element[T] interface permitting interaction with the values stored in the collections. Collections may be iterated forwards (start to end), reverse (end to start), or forwards with a filter (TakeWhile()) It has the following interface:

type Iterator[T any] interface {
	Start() Element[T]
	Next() Element[T]
}

An iteration can be performed as follows

ll := slist.New[int]()
// add values, then...
iter := ll.Iterator()

for e := iter.Start() ; e != nil; e = iter.Next() {
    // do something with e.Value() or e.ValuePtr()
}

Collections must not be modified during iteration. Modification of the collection will cause iterators to panic on the next call to Start() or Next().

Element

Iteration yields Element[T] permitting access to the value stored in the collection at that point. It has the following methods:

type Element[T any] interface {
	Value() T
	ValuePtr() *T
}

Note that attempting to modify an item in a collection that implements Set[T] via ValuePtr() will panic as changing a value breaks the implementation of a set.

Functions

Some function signatures are provided for you to create your own logic to support various collection operations

ComparerFunc

This function allows the developer to supply a custom compare function to a collection for a type that is not one of the supported types.

A compare function should return < 0 if a < b, 0 if a == b else > 0 and looks like this, e.g. for a collection typed on int

func myComparer(int a, int b) int {
    return a - b
}

PredicateFunc

For many of the Enumerable methods, a predicate function must be given as an argument. A value is selected when the predicate function returns true. For instance, to filter all even numbers from a collection of int it might look like this

func filterEvens(int value) bool {
    return value % 2 == 0
}

HashFunc

For collections that use a hash table to store values (currently only HashSet), a function to compute a hash value for types not supported by default (as per ComparerFunc) must be provided.

The hash algorithms for the supported types are exported as function variables by the hashset sub-package so can be used to construct hashes for struct types.

DeepCopyFunc

The default action if an instance of this function is not passed to the collection constructor is that when making copies of collection elements, they will be copied by value. If the element type is a pointer, or a struct containing pointers this may not be what you want.

Should you need to deep-copy elements, supply an implementation of this function to the collection's constructor.

The function should return a new instance of the type which is a deep copy of the instance passed as an argument.

Enumerable

Enumerable defines a set of methods for enumerating a collection in various ways. All collections are enumerable.

type Enumerable[T any] interface {
	Any(predicate PredicateFunc[T]) bool
	All(predicate PredicateFunc[T]) bool
    Find(predicate functions.PredicateFunc[T]) Element[T]
    FindAll(predicate functions.PredicateFunc[T]) []Element[T]
	ForEach(func(Element[T]))
    Min() T
    Max() T
	Map(func(T) T) Collection[T]
	Select(PredicateFunc[T]) Collection[T]
    SelectDeep(functions.PredicateFunc[T]) Collection[T]
}

Benchmarks

In the following tables, the data in the columns have the following meanings

  • Elements - Number of elements stored in collection.
  • Operation
    • Add/Push/Enqueue - Starting with an empty collection, add the given number of elements one at a time to what is logically the end of the collection. ns/op is the time to add all the elements.
    • Remove/Pop/Dequeue - Starting with a full collection, items are all removed one at a time. ns/op is the time to remove all the elements.
    • Sort - For collections that support sorting, take a collection collection containing the given number of elements. ns/op is the time to sort the collection.
    • Contains - Collection is filled with given number of elements. Source element slice is shuffled and the values it contains are looked up in the collection ns/op is the average time to lookup any single element in the collection.
    • Min, Max - Collection is filled with given number of elements. Min and Max are then taken b.N times.
  • TS (ThreadSafe)
    • :heavy_check_mark: - Thread safety enabled. Lock is acquired/released on entry/exit of collection method under test.
    • :x: - Thread safety not enabled.
    • Empty - Locking is negligible compared to total run time of the method so not benchmarked.
  • PS (Pre-sized)
    • :heavy_check_mark: - Backing store initialized to given number of elements
    • :x: - Backing store not pre-initialized meaning that it has to grow periodically.
    • Empty - Collection does not support a backing store that can be pre-sized.
  • CC (Concurrent)
    • :heavy_check_mark: - Concurrent algorithm enabled.
    • :x: - Concurrent algorithm not enabled.
    • Empty - No concurrency option on this algorithm.

Benchmarks are run on collections of int

Intel(R) Core(TM) i7-7800X

CPU Specification

  • Lists

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    DListAdd100:x: 5,162 3,200100
    DListAdd1,000:x: 40,489 32,0001,000
    DListAdd10,000:x: 377,561 320,00010,000
    DListAdd100,000:x:5,236,563 3,200,022100,000
    DListAdd100:heavy_check_mark: 6,947 3,200100
    DListAdd1,000:heavy_check_mark: 72,904 32,0001,000
    DListAdd10,000:heavy_check_mark: 613,653 320,00010,000
    DListAdd100,000:heavy_check_mark:7,706,782 3,200,038100,000
    DListRemove100:x: 1,456 00
    DListRemove1,000:x: 12,370 00
    DListRemove10,000:x: 127,025 00
    DListRemove100,000:x:1,736,280 10
    DListRemove100:heavy_check_mark: 4,059 00
    DListRemove1,000:heavy_check_mark: 37,468 00
    DListRemove10,000:heavy_check_mark: 363,614 00
    DListRemove100,000:heavy_check_mark:3,959,233 10
    DListSort100 5,612 00
    DListSort1,000 101,728 00
    DListSort10,0001,612,152 00
    DListSort100,00030,913,500 00
    DListMin100 354.1 00
    DListMin1,000 3,336 00
    DListMin10,000 32,851 00
    DListMin100,000 330,851 00
    DListMax100 353.1 00
    DListMax1,000 3,395 00
    DListMax10,000 33,297 00
    DListMax100,000 332,389 00
    DListContains100 160.3 00
    DListContains1,000 1,421 00
    DListContains10,000 14,289 00
    DListContains100,000 142,327 00
    SListAdd100:x: 4,252 2,400100
    SListAdd1,000:x: 39,132 24,0001,000
    SListAdd10,000:x: 314,291 240,00010,000
    SListAdd100,000:x:3,662,899 2,400,011100,000
    SListAdd100:heavy_check_mark: 8,217 2,400100
    SListAdd1,000:heavy_check_mark: 54,659 24,0001,000
    SListAdd10,000:heavy_check_mark: 552,099 240,00010,000
    SListAdd100,000:heavy_check_mark:5,989,855 2,400,000100,000
    SListRemove100:x: 1,185 00
    SListRemove1,000:x: 12,092 00
    SListRemove10,000:x: 104,223 00
    SListRemove100,000:x:1,033,820 00
    SListRemove100:heavy_check_mark: 3,688 00
    SListRemove1,000:heavy_check_mark: 34,738 00
    SListRemove10,000:heavy_check_mark: 350,273 00
    SListRemove100,000:heavy_check_mark:3,309,956 00
    SListSort100 5,121 00
    SListSort1,000 93,342 00
    SListSort10,0001,461,912 00
    SListSort100,00025,846,042 00
    SListMin100 346.0 00
    SListMin1,000 3,280 00
    SListMin10,000 32,769 00
    SListMin100,000 328,320 00
    SListMax100 348.2 00
    SListMax1,000 3,341 00
    SListMax10,000 33,216 00
    SListMax100,000 331,937 00
    SListContains100 168.1 00
    SListContains1,000 1,525 00
    SListContains10,000 15,196 00
    SListContains100,000 154,434 00
  • Queues

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    QueueEnqueue100:x::x: 2,227 1,7923
    QueueEnqueue1,000:x::x: 15,661 16,1286
    QueueEnqueue10,000:x::x: 168,893 261,88810
    QueueEnqueue100,000:x::x:1,630,451 2,096,90113
    QueueEnqueue100:x::heavy_check_mark: 661.9 00
    QueueEnqueue1,000:x::heavy_check_mark: 8,476 00
    QueueEnqueue10,000:x::heavy_check_mark: 121,440 00
    QueueEnqueue100,000:x::heavy_check_mark:1,248,483 20
    QueueEnqueue100:heavy_check_mark::x: 4,003 1,7923
    QueueEnqueue1,000:heavy_check_mark::x: 45,827 16,1286
    QueueEnqueue10,000:heavy_check_mark::x: 367,966 261,88810
    QueueEnqueue100,000:heavy_check_mark::x:3,742,788 2,096,89913
    QueueEnqueue100:heavy_check_mark::heavy_check_mark: 2,564 00
    QueueEnqueue1,000:heavy_check_mark::heavy_check_mark: 36,120 00
    QueueEnqueue10,000:heavy_check_mark::heavy_check_mark: 321,078 00
    QueueEnqueue100,000:heavy_check_mark::heavy_check_mark:3,303,376 00
    QueueDequeue100:x: 638.3 00
    QueueDequeue1,000:x: 13,667 00
    QueueDequeue10,000:x: 129,131 00
    QueueDequeue100,000:x:1,258,166 10
    QueueDequeue100:heavy_check_mark: 2,435 00
    QueueDequeue1,000:heavy_check_mark: 33,463 00
    QueueDequeue10,000:heavy_check_mark: 324,595 00
    QueueDequeue100,000:heavy_check_mark:3,283,561 00
    QueueSort100 4,867 9282
    QueueSort1,000 88,174 8,2242
    QueueSort10,0001,333,856 81,9522
    QueueSort100,00016,674,301 802,8492
    QueueMin100:x: 960.2 00
    QueueMin1,000:x: 3,300 00
    QueueMin10,000:x: 33,681 00
    QueueMin100,000:x: 337,106 00
    QueueMin100,000:heavy_check_mark: 107,563 1,89335
    QueueMax100:x: 954.1 00
    QueueMax1,000:x: 3,376 00
    QueueMax10,000:x: 32,882 00
    QueueMax100,000:x: 329,761 00
    QueueMax100,000:heavy_check_mark: 107,083 1,88135
    QueueContains100 595.5 00
    QueueContains1,000 5,750 00
    QueueContains10,000 58,685 00
    QueueContains100,000 585,437 00
    RingBufferEnqueue100:x: 790.1 00
    RingBufferEnqueue1,000:x: 18,859 00
    RingBufferEnqueue10,000:x: 138,050 00
    RingBufferEnqueue100,000:x:1,368,396 00
    RingBufferEnqueue100:heavy_check_mark: 3,292 00
    RingBufferEnqueue1,000:heavy_check_mark: 36,771 00
    RingBufferEnqueue10,000:heavy_check_mark: 341,061 00
    RingBufferEnqueue100,000:heavy_check_mark:3,539,813 20
    RingBufferDequeue100:x: 609.1 00
    RingBufferDequeue1,000:x: 3,954 00
    RingBufferDequeue10,000:x: 36,054 00
    RingBufferDequeue100,000:x: 366,657 10
    RingBufferDequeue100:heavy_check_mark: 2,786 00
    RingBufferDequeue1,000:heavy_check_mark: 28,678 00
    RingBufferDequeue10,000:heavy_check_mark: 290,307 00
    RingBufferDequeue100,000:heavy_check_mark:2,791,561 10
    RingBufferSort100 10,418 9282
    RingBufferSort1,000 113,191 8,2242
    RingBufferSort10,0001,444,259 81,9522
    RingBufferSort100,00017,667,739 802,8492
    RingBufferMin100 943.2 00
    RingBufferMin1,000 9,339 00
    RingBufferMin10,000 95,596 00
    RingBufferMin100,000 953,840 00
    RingBufferMax100 938.7 00
    RingBufferMax1,000 9,404 00
    RingBufferMax10,000 94,722 00
    RingBufferMax100,000 945,439 00
    RingBufferContains100 598.5 00
    RingBufferContains1,000 5,884 00
    RingBufferContains10,000 58,109 00
    RingBufferContains100,000 589,616 00
  • Sets

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    HashSetAdd100:x::x: 8,841 9,964107
    HashSetAdd1,000:x::x: 153,902 180,7341,028
    HashSetAdd10,000:x::x:1,518,866 1,432,84210,209
    HashSetAdd100,000:x::x:17,702,102 12,233,593103,929
    HashSetAdd100:x::heavy_check_mark: 6,414 2,113101
    HashSetAdd1,000:x::heavy_check_mark: 80,157 16,0001,000
    HashSetAdd10,000:x::heavy_check_mark: 842,747 160,00410,000
    HashSetAdd100,000:x::heavy_check_mark:11,545,505 2,076,248101,653
    HashSetAdd100:heavy_check_mark::x: 19,281 9,965107
    HashSetAdd1,000:heavy_check_mark::x: 175,249 180,7011,028
    HashSetAdd10,000:heavy_check_mark::x:1,678,002 1,432,75710,209
    HashSetAdd100,000:heavy_check_mark::x:19,997,582 12,236,830103,940
    HashSetAdd100:heavy_check_mark::heavy_check_mark: 12,774 2,113101
    HashSetAdd1,000:heavy_check_mark::heavy_check_mark: 98,353 16,0001,000
    HashSetAdd10,000:heavy_check_mark::heavy_check_mark:1,100,168 160,00010,000
    HashSetAdd100,000:heavy_check_mark::heavy_check_mark:13,549,729 2,077,883101,659
    HashSetRemove100:x: 6,100 00
    HashSetRemove1,000:x: 52,680 00
    HashSetRemove10,000:x: 525,006 00
    HashSetRemove100,000:x:7,590,020 00
    HashSetRemove100:heavy_check_mark: 7,676 00
    HashSetRemove1,000:heavy_check_mark: 77,053 00
    HashSetRemove10,000:heavy_check_mark: 832,967 00
    HashSetRemove100,000:heavy_check_mark:9,916,081 00
    HashSetMin100 1,378 00
    HashSetMin1,000 14,594 00
    HashSetMin10,000 136,113 00
    HashSetMin100,0001,925,612 00
    HashSetMax100 1,392 00
    HashSetMax1,000 14,448 00
    HashSetMax10,000 135,533 00
    HashSetMax100,0001,915,966 00
    HashSetContains100 27.3900
    HashSetContains1,000 37.8500
    HashSetContains10,000 44.7200
    HashSetContains100,000 78.7300
    OrderedSetAdd100:x: 5,782 4,800100
    OrderedSetAdd1,000:x: 139,177 48,0001,000
    OrderedSetAdd10,000:x:1,777,309 480,00110,000
    OrderedSetAdd100,000:x:27,412,678 4,800,011100,000
    OrderedSetAdd100:heavy_check_mark: 17,031 4,800100
    OrderedSetAdd1,000:heavy_check_mark: 132,474 48,0001,000
    OrderedSetAdd10,000:heavy_check_mark:1,897,430 480,00110,000
    OrderedSetAdd100,000:heavy_check_mark:29,175,012 4,800,014100,000
    OrderedSetRemove100:x: 6,572 00
    OrderedSetRemove1,000:x: 98,252 00
    OrderedSetRemove10,000:x:1,371,899 00
    OrderedSetRemove100,000:x:22,635,769 00
    OrderedSetRemove100:heavy_check_mark: 5,266 00
    OrderedSetRemove1,000:heavy_check_mark: 101,616 00
    OrderedSetRemove10,000:heavy_check_mark:1,364,635 00
    OrderedSetRemove100,000:heavy_check_mark:23,862,490 00
    OrderedSetMin100 6.21600
    OrderedSetMin1,000 6.66000
    OrderedSetMin10,000 9.11100
    OrderedSetMin100,000 11.1300
    OrderedSetMax100 4.56000
    OrderedSetMax1,000 5.84300
    OrderedSetMax10,000 6.87500
    OrderedSetMax100,000 8.87600
    OrderedSetContains100 33.1400
    OrderedSetContains1,000 75.9700
    OrderedSetContains10,000 111.6 00
    OrderedSetContains100,000 197.8 00
  • Stacks

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    StackPush100:x::x: 1,122 2,0163
    StackPush1,000:x::x: 6,525 18,6566
    StackPush10,000:x::x: 50,456 299,23910
    StackPush100,000:x::x: 751,467 2,363,62213
    StackPush100:x::heavy_check_mark: 586.5 00
    StackPush1,000:x::heavy_check_mark: 3,763 00
    StackPush10,000:x::heavy_check_mark: 43,139 00
    StackPush100,000:x::heavy_check_mark: 388,153 30
    StackPush100:heavy_check_mark::x: 3,068 2,0163
    StackPush1,000:heavy_check_mark::x: 19,165 18,6566
    StackPush10,000:heavy_check_mark::x: 323,252 299,23310
    StackPush100,000:heavy_check_mark::x:3,271,576 2,363,61813
    StackPush100:heavy_check_mark::heavy_check_mark: 3,276 00
    StackPush1,000:heavy_check_mark::heavy_check_mark: 34,538 00
    StackPush10,000:heavy_check_mark::heavy_check_mark: 274,057 00
    StackPush100,000:heavy_check_mark::heavy_check_mark:2,857,594 00
    StackPop100:x: 720.5 00
    StackPop1,000:x: 3,349 00
    StackPop10,000:x: 36,320 10
    StackPop100,000:x: 342,374 20
    StackPop100:heavy_check_mark: 3,014 00
    StackPop1,000:heavy_check_mark: 22,547 00
    StackPop10,000:heavy_check_mark: 276,337 00
    StackPop100,000:heavy_check_mark:2,669,541 10
    StackSort100 4,634 321
    StackSort1,000 107,059 321
    StackSort10,0001,295,618 321
    StackSort100,00016,371,947 331
    StackMin100:x: 371.1 00
    StackMin1,000:x: 3,618 00
    StackMin10,000:x: 36,231 00
    StackMin100,000:x: 357,545 00
    StackMin100,000:heavy_check_mark: 108,811 1,88235
    StackMax100:x: 379.1 00
    StackMax1,000:x: 3,639 00
    StackMax10,000:x: 35,200 00
    StackMax100,000:x: 354,018 00
    StackMax100,000:heavy_check_mark: 109,385 1,88235
    StackContains100:x: 156.6 00
    StackContains1,000:x: 1,363 00
    StackContains10,000:x: 14,037 00
    StackContains100,000:x: 139,171 00
    StackContains100,000:heavy_check_mark: 100,202 1,60029
Intel(R) Core(TM) i7-12700H

CPU Specification

  • Lists

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    DListAdd100:x: 2,988 3,200100
    DListAdd1,000:x: 26,507 32,0001,000
    DListAdd10,000:x: 243,373 320,00010,000
    DListAdd100,000:x:3,558,804 3,200,034100,000
    DListAdd100:heavy_check_mark: 6,702 3,200100
    DListAdd1,000:heavy_check_mark: 51,964 32,0001,000
    DListAdd10,000:heavy_check_mark: 540,395 320,00010,000
    DListAdd100,000:heavy_check_mark:6,676,934 3,200,027100,000
    DListRemove100:x: 866.4 00
    DListRemove1,000:x: 11,226 00
    DListRemove10,000:x: 107,712 00
    DListRemove100,000:x: 988,447 10
    DListRemove100:heavy_check_mark: 3,527 00
    DListRemove1,000:heavy_check_mark: 30,529 00
    DListRemove10,000:heavy_check_mark: 322,074 10
    DListRemove100,000:heavy_check_mark:2,764,714 00
    DListSort100 4,165 00
    DListSort1,000 71,783 00
    DListSort10,0001,325,536 00
    DListSort100,00021,481,198 00
    DListMin100 142.2 00
    DListMin1,000 1,224 00
    DListMin10,000 14,411 00
    DListMin100,000 128,253 00
    DListMax100 141.4 00
    DListMax1,000 1,288 00
    DListMax10,000 13,221 00
    DListMax100,000 130,500 00
    DListContains100 74.7300
    DListContains1,000 682.6 00
    DListContains10,000 7,257 00
    DListContains100,000 75,901 00
    SListAdd100:x: 3,204 2,400100
    SListAdd1,000:x: 29,243 24,0001,000
    SListAdd10,000:x: 245,878 240,00010,000
    SListAdd100,000:x:2,632,169 2,400,007100,000
    SListAdd100:heavy_check_mark: 6,467 2,400100
    SListAdd1,000:heavy_check_mark: 42,146 24,0001,000
    SListAdd10,000:heavy_check_mark: 410,458 240,00010,000
    SListAdd100,000:heavy_check_mark:4,451,332 2,400,007100,000
    SListRemove100:x: 1,003 00
    SListRemove1,000:x: 9,262 00
    SListRemove10,000:x: 82,960 00
    SListRemove100,000:x: 444,766 00
    SListRemove100:heavy_check_mark: 3,390 00
    SListRemove1,000:heavy_check_mark: 29,534 00
    SListRemove10,000:heavy_check_mark: 258,203 00
    SListRemove100,000:heavy_check_mark:2,518,566 00
    SListSort100 3,844 00
    SListSort1,000 60,946 00
    SListSort10,0001,115,609 00
    SListSort100,00019,240,269 00
    SListMin100 145.1 00
    SListMin1,000 1,359 00
    SListMin10,000 13,594 00
    SListMin100,000 134,319 00
    SListMax100 151.6 00
    SListMax1,000 1,394 00
    SListMax10,000 13,703 00
    SListMax100,000 131,296 00
    SListContains100 75.8900
    SListContains1,000 676.4 00
    SListContains10,000 6,859 00
    SListContains100,000 69,234 00
  • Queues

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    QueueEnqueue100:x::x: 1,447 1,7923
    QueueEnqueue1,000:x::x: 9,382 16,1286
    QueueEnqueue10,000:x::x: 86,595 261,88910
    QueueEnqueue100,000:x::x: 805,183 2,096,90413
    QueueEnqueue100:x::heavy_check_mark: 687.1 00
    QueueEnqueue1,000:x::heavy_check_mark: 5,328 00
    QueueEnqueue10,000:x::heavy_check_mark: 56,027 00
    QueueEnqueue100,000:x::heavy_check_mark: 556,338 10
    QueueEnqueue100:heavy_check_mark::x: 3,599 1,7923
    QueueEnqueue1,000:heavy_check_mark::x: 31,312 16,1286
    QueueEnqueue10,000:heavy_check_mark::x: 283,523 261,88810
    QueueEnqueue100,000:heavy_check_mark::x:2,672,735 2,096,89713
    QueueEnqueue100:heavy_check_mark::heavy_check_mark: 2,985 00
    QueueEnqueue1,000:heavy_check_mark::heavy_check_mark: 28,162 00
    QueueEnqueue10,000:heavy_check_mark::heavy_check_mark: 233,762 00
    QueueEnqueue100,000:heavy_check_mark::heavy_check_mark:2,338,408 00
    QueueDequeue100:x: 688.3 00
    QueueDequeue1,000:x: 5,216 00
    QueueDequeue10,000:x: 57,024 00
    QueueDequeue100,000:x: 472,703 00
    QueueDequeue100:heavy_check_mark: 2,709 00
    QueueDequeue1,000:heavy_check_mark: 26,728 00
    QueueDequeue10,000:heavy_check_mark: 237,120 00
    QueueDequeue100,000:heavy_check_mark:2,201,107 00
    QueueSort100 5,050 9282
    QueueSort1,000 73,676 8,2242
    QueueSort10,000 948,724 81,9522
    QueueSort100,00011,564,077 802,8482
    QueueMin100:x: 222.1 00
    QueueMin1,000:x: 1,160 00
    QueueMin10,000:x: 12,438 00
    QueueMin100,000:x: 128,021 00
    QueueMin100,000:heavy_check_mark: 64,953 3,03652
    QueueMax100:x: 223.1 00
    QueueMax1,000:x: 1,250 00
    QueueMax10,000:x: 11,444 00
    QueueMax100,000:x: 113,885 00
    QueueMax100,000:heavy_check_mark: 60,476 3,03452
    QueueContains100 238.6 00
    QueueContains1,000 2,336 00
    QueueContains10,000 23,404 00
    QueueContains100,000 236,049 00
    RingBufferEnqueue100:x: 800.2 00
    RingBufferEnqueue1,000:x: 6,197 00
    RingBufferEnqueue10,000:x: 57,253 00
    RingBufferEnqueue100,000:x: 554,793 10
    RingBufferEnqueue100:heavy_check_mark: 3,140 00
    RingBufferEnqueue1,000:heavy_check_mark: 25,130 00
    RingBufferEnqueue10,000:heavy_check_mark: 239,471 00
    RingBufferEnqueue100,000:heavy_check_mark:2,340,666 00
    RingBufferDequeue100:x: 472.7 00
    RingBufferDequeue1,000:x: 3,147 00
    RingBufferDequeue10,000:x: 32,156 00
    RingBufferDequeue100,000:x: 276,973 30
    RingBufferDequeue100:heavy_check_mark: 2,860 00
    RingBufferDequeue1,000:heavy_check_mark: 25,374 00
    RingBufferDequeue10,000:heavy_check_mark: 221,808 00
    RingBufferDequeue100,000:heavy_check_mark:2,314,409 10
    RingBufferSort100 5,245 9282
    RingBufferSort1,000 67,790 8,2242
    RingBufferSort10,000 921,211 81,9522
    RingBufferSort100,00012,147,900 802,8482
    RingBufferMin100 227.5 00
    RingBufferMin1,000 2,249 00
    RingBufferMin10,000 22,563 00
    RingBufferMin100,000 224,869 00
    RingBufferMax100 229.2 00
    RingBufferMax1,000 2,262 00
    RingBufferMax10,000 22,853 00
    RingBufferMax100,000 226,723 00
    RingBufferContains100 249.9 00
    RingBufferContains1,000 2,392 00
    RingBufferContains10,000 23,815 00
    RingBufferContains100,000 243,623 00
  • Sets

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    HashSetAdd100:x::x: 10,294 9,963107
    HashSetAdd1,000:x::x: 107,654 180,6941,028
    HashSetAdd10,000:x::x:1,170,594 1,432,76510,209
    HashSetAdd100,000:x::x:11,240,331 12,234,374103,932
    HashSetAdd100:x::heavy_check_mark: 9,209 2,113101
    HashSetAdd1,000:x::heavy_check_mark: 66,145 16,0001,000
    HashSetAdd10,000:x::heavy_check_mark: 688,392 160,00310,000
    HashSetAdd100,000:x::heavy_check_mark:7,238,287 2,078,747101,662
    HashSetAdd100:heavy_check_mark::x: 14,157 9,965107
    HashSetAdd1,000:heavy_check_mark::x: 133,932 180,6931,028
    HashSetAdd10,000:heavy_check_mark::x:1,225,502 1,433,05310,210
    HashSetAdd100,000:heavy_check_mark::x:11,446,165 12,236,271103,938
    HashSetAdd100:heavy_check_mark::heavy_check_mark: 11,180 2,114101
    HashSetAdd1,000:heavy_check_mark::heavy_check_mark: 71,554 16,0001,000
    HashSetAdd10,000:heavy_check_mark::heavy_check_mark: 755,077 160,00110,000
    HashSetAdd100,000:heavy_check_mark::heavy_check_mark:8,826,382 2,078,576101,661
    HashSetRemove100:x: 6,245 00
    HashSetRemove1,000:x: 47,646 00
    HashSetRemove10,000:x: 410,425 00
    HashSetRemove100,000:x:4,901,910 00
    HashSetRemove100:heavy_check_mark: 7,600 00
    HashSetRemove1,000:heavy_check_mark: 58,179 00
    HashSetRemove10,000:heavy_check_mark: 468,389 00
    HashSetRemove100,000:heavy_check_mark:6,180,152 00
    HashSetMin100 738.1 00
    HashSetMin1,000 9,053 00
    HashSetMin10,000 85,572 00
    HashSetMin100,000 821,231 00
    HashSetMax100 741.4 00
    HashSetMax1,000 9,181 00
    HashSetMax10,000 86,746 00
    HashSetMax100,000 830,899 00
    HashSetContains100 9.69600
    HashSetContains1,000 15.7100
    HashSetContains10,000 31.4100
    HashSetContains100,000 37.6600
    OrderedSetAdd100:x: 7,095 4,800100
    OrderedSetAdd1,000:x: 104,035 48,0001,000
    OrderedSetAdd10,000:x:1,293,838 480,00410,000
    OrderedSetAdd100,000:x:19,638,457 4,800,034100,000
    OrderedSetAdd100:heavy_check_mark: 10,053 4,800100
    OrderedSetAdd1,000:heavy_check_mark: 108,203 48,0001,000
    OrderedSetAdd10,000:heavy_check_mark:1,414,259 480,00310,000
    OrderedSetAdd100,000:heavy_check_mark:21,027,762 4,800,031100,000
    OrderedSetRemove100:x: 3,186 00
    OrderedSetRemove1,000:x: 71,386 00
    OrderedSetRemove10,000:x:1,015,825 40
    OrderedSetRemove100,000:x:16,077,759 00
    OrderedSetRemove100:heavy_check_mark: 5,102 00
    OrderedSetRemove1,000:heavy_check_mark: 81,914 00
    OrderedSetRemove10,000:heavy_check_mark:1,126,826 80
    OrderedSetRemove100,000:heavy_check_mark:17,350,911 00
    OrderedSetMin100 2.07100
    OrderedSetMin1,000 2.42800
    OrderedSetMin10,000 3.48400
    OrderedSetMin100,000 4.85600
    OrderedSetMax100 2.23900
    OrderedSetMax1,000 3.63900
    OrderedSetMax10,000 5.30200
    OrderedSetMax100,000 4.98600
    OrderedSetContains100 11.3300
    OrderedSetContains1,000 46.4200
    OrderedSetContains10,000 81.5200
    OrderedSetContains100,000 180.9 00
  • Stacks

    Expand
    CollectionOperationElementsTSPSCCns/opB/opallocs/op
    StackPush100:x::x: 1,281 2,0163
    StackPush1,000:x::x: 6,305 18,6566
    StackPush10,000:x::x: 76,407 299,23210
    StackPush100,000:x::x: 582,318 2,363,62913
    StackPush100:x::heavy_check_mark: 494.4 00
    StackPush1,000:x::heavy_check_mark: 3,266 00
    StackPush10,000:x::heavy_check_mark: 29,567 00
    StackPush100,000:x::heavy_check_mark: 277,348 20
    StackPush100:heavy_check_mark::x: 3,637 2,0163
    StackPush1,000:heavy_check_mark::x: 26,152 18,6566
    StackPush10,000:heavy_check_mark::x: 264,761 299,23210
    StackPush100,000:heavy_check_mark::x:2,559,970 2,363,61713
    StackPush100:heavy_check_mark::heavy_check_mark: 2,672 00
    StackPush1,000:heavy_check_mark::heavy_check_mark: 25,598 00
    StackPush10,000:heavy_check_mark::heavy_check_mark: 230,666 00
    StackPush100,000:heavy_check_mark::heavy_check_mark:2,219,721 00
    StackPop100:x: 408.0 00
    StackPop1,000:x: 2,888 00
    StackPop10,000:x: 29,767 00
    StackPop100,000:x: 265,711 60
    StackPop100:heavy_check_mark: 2,639 00
    StackPop1,000:heavy_check_mark: 24,835 00
    StackPop10,000:heavy_check_mark: 224,791 00
    StackPop100,000:heavy_check_mark:2,188,625 30
    StackSort100 4,914 321
    StackSort1,000 66,146 321
    StackSort10,000 910,777 321
    StackSort100,00011,592,799 321
    StackMin100:x: 145.6 00
    StackMin1,000:x: 1,273 00
    StackMin10,000:x: 11,584 00
    StackMin100,000:x: 114,872 00
    StackMin100,000:heavy_check_mark: 61,672 3,03652
    StackMax100:x: 149.2 00
    StackMax1,000:x: 1,269 00
    StackMax10,000:x: 11,410 00
    StackMax100,000:x: 114,919 00
    StackMax100,000:heavy_check_mark: 59,504 3,03452
    StackContains100:x: 57.6900
    StackContains1,000:x: 468.5 00
    StackContains10,000:x: 4,514 00
    StackContains100,000:x: 45,569 00
    StackContains100,000:heavy_check_mark: 55,627 2,49645