mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
Merge pull request #242 from lorentey/HashTreeCollections
This commit is contained in:
117 files changed
+1260
-1273
No files matched your search
+47
-47
@@ -1,42 +1,42 @@
|
||||
{
|
||||
"kind": "group",
|
||||
"title": "ShareableDictionary Benchmarks",
|
||||
"directory": "ShareableDictionary",
|
||||
"title": "TreeDictionary Benchmarks",
|
||||
"directory": "TreeDictionary",
|
||||
"contents": [
|
||||
{
|
||||
"kind": "group",
|
||||
"title": "ShareableDictionary Operations",
|
||||
"title": "TreeDictionary Operations",
|
||||
"contents": [
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "all",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
"ShareableDictionary<Int, Int> sequential iteration",
|
||||
"ShareableDictionary<Int, Int> sequential iteration, indices",
|
||||
"ShareableDictionary<Int, Int>.Keys sequential iteration",
|
||||
"ShareableDictionary<Int, Int>.Values sequential iteration",
|
||||
"ShareableDictionary<Int, Int> indexing subscript",
|
||||
"ShareableDictionary<Int, Int> subscript, successful lookups",
|
||||
"ShareableDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
"ShareableDictionary<Int, Int> subscript, noop setter",
|
||||
"ShareableDictionary<Int, Int> subscript, set existing",
|
||||
"ShareableDictionary<Int, Int> subscript, _modify",
|
||||
"ShareableDictionary<Int, Int> subscript, insert, unique",
|
||||
"ShareableDictionary<Int, Int> subscript, insert, shared",
|
||||
"ShareableDictionary<Int, Int> subscript, remove existing, unique",
|
||||
"ShareableDictionary<Int, Int> subscript, remove existing, shared",
|
||||
"ShareableDictionary<Int, Int> subscript, remove missing",
|
||||
"ShareableDictionary<Int, Int> defaulted subscript, successful lookups",
|
||||
"ShareableDictionary<Int, Int> defaulted subscript, unsuccessful lookups",
|
||||
"ShareableDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
"ShareableDictionary<Int, Int> defaulted subscript, _modify missing",
|
||||
"ShareableDictionary<Int, Int> successful index(forKey:)",
|
||||
"ShareableDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"ShareableDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
"ShareableDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"ShareableDictionary<Int, Int> random removals (existing keys)",
|
||||
"ShareableDictionary<Int, Int> random removals (missing keys)",
|
||||
"TreeDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
"TreeDictionary<Int, Int> sequential iteration",
|
||||
"TreeDictionary<Int, Int> sequential iteration, indices",
|
||||
"TreeDictionary<Int, Int>.Keys sequential iteration",
|
||||
"TreeDictionary<Int, Int>.Values sequential iteration",
|
||||
"TreeDictionary<Int, Int> indexing subscript",
|
||||
"TreeDictionary<Int, Int> subscript, successful lookups",
|
||||
"TreeDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
"TreeDictionary<Int, Int> subscript, noop setter",
|
||||
"TreeDictionary<Int, Int> subscript, set existing",
|
||||
"TreeDictionary<Int, Int> subscript, _modify",
|
||||
"TreeDictionary<Int, Int> subscript, insert, unique",
|
||||
"TreeDictionary<Int, Int> subscript, insert, shared",
|
||||
"TreeDictionary<Int, Int> subscript, remove existing, unique",
|
||||
"TreeDictionary<Int, Int> subscript, remove existing, shared",
|
||||
"TreeDictionary<Int, Int> subscript, remove missing",
|
||||
"TreeDictionary<Int, Int> defaulted subscript, successful lookups",
|
||||
"TreeDictionary<Int, Int> defaulted subscript, unsuccessful lookups",
|
||||
"TreeDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
"TreeDictionary<Int, Int> defaulted subscript, _modify missing",
|
||||
"TreeDictionary<Int, Int> successful index(forKey:)",
|
||||
"TreeDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"TreeDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
"TreeDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"TreeDictionary<Int, Int> random removals (existing keys)",
|
||||
"TreeDictionary<Int, Int> random removals (missing keys)",
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -50,7 +50,7 @@
|
||||
"kind": "chart",
|
||||
"title": "init(uniqueKeysWithValues:)",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
"TreeDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
"Dictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
"OrderedDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
]
|
||||
@@ -59,7 +59,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> sequential iteration",
|
||||
"TreeDictionary<Int, Int> sequential iteration",
|
||||
"Dictionary<Int, Int> sequential iteration",
|
||||
"OrderedDictionary<Int, Int> sequential iteration",
|
||||
]
|
||||
@@ -68,7 +68,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration [Keys]",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int>.Keys sequential iteration",
|
||||
"TreeDictionary<Int, Int>.Keys sequential iteration",
|
||||
"Dictionary<Int, Int>.Keys sequential iteration",
|
||||
"OrderedDictionary<Int, Int>.Keys sequential iteration",
|
||||
]
|
||||
@@ -77,7 +77,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration [Values]",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int>.Values sequential iteration",
|
||||
"TreeDictionary<Int, Int>.Values sequential iteration",
|
||||
"Dictionary<Int, Int>.Values sequential iteration",
|
||||
"OrderedDictionary<Int, Int>.Values sequential iteration",
|
||||
]
|
||||
@@ -86,7 +86,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration using indices",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> sequential iteration, indices",
|
||||
"TreeDictionary<Int, Int> sequential iteration, indices",
|
||||
"Dictionary<Int, Int> sequential iteration, indices",
|
||||
"OrderedDictionary<Int, Int> sequential iteration, indices",
|
||||
]
|
||||
@@ -95,7 +95,7 @@
|
||||
"kind": "chart",
|
||||
"title": "indexing subscript",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> indexing subscript",
|
||||
"TreeDictionary<Int, Int> indexing subscript",
|
||||
"Dictionary<Int, Int> indexing subscript",
|
||||
"OrderedDictionary<Int, Int> indexing subscript",
|
||||
]
|
||||
@@ -104,7 +104,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, successful lookups",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, successful lookups",
|
||||
"TreeDictionary<Int, Int> subscript, successful lookups",
|
||||
"Dictionary<Int, Int> subscript, successful lookups",
|
||||
"OrderedDictionary<Int, Int> subscript, successful lookups",
|
||||
]
|
||||
@@ -113,7 +113,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, unsuccessful lookups",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
"TreeDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
"Dictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
"OrderedDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
]
|
||||
@@ -122,7 +122,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, insert into unique collection",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, insert, unique",
|
||||
"TreeDictionary<Int, Int> subscript, insert, unique",
|
||||
"Dictionary<Int, Int> subscript, insert, unique",
|
||||
"Dictionary<Int, Int> subscript, insert, reserving capacity",
|
||||
"OrderedDictionary<Int, Int> subscript, append, unique",
|
||||
@@ -133,7 +133,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, insert into shared collection",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, insert, shared",
|
||||
"TreeDictionary<Int, Int> subscript, insert, shared",
|
||||
"Dictionary<Int, Int> subscript, insert, shared",
|
||||
"OrderedDictionary<Int, Int> subscript, append, shared",
|
||||
]
|
||||
@@ -142,7 +142,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, remove existing from unique collection",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, remove existing, unique",
|
||||
"TreeDictionary<Int, Int> subscript, remove existing, unique",
|
||||
"Dictionary<Int, Int> subscript, remove existing, unique",
|
||||
"OrderedDictionary<Int, Int> subscript, remove existing, unique",
|
||||
]
|
||||
@@ -151,7 +151,7 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, remove existing from shared collection",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, remove existing, shared",
|
||||
"TreeDictionary<Int, Int> subscript, remove existing, shared",
|
||||
"Dictionary<Int, Int> subscript, remove existing, shared",
|
||||
"OrderedDictionary<Int, Int> subscript, remove existing, shared",
|
||||
]
|
||||
@@ -160,8 +160,8 @@
|
||||
"kind": "chart",
|
||||
"title": "subscript, _modify existing",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> subscript, _modify",
|
||||
"ShareableDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
"TreeDictionary<Int, Int> subscript, _modify",
|
||||
"TreeDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
"Dictionary<Int, Int> subscript, _modify",
|
||||
"Dictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
"OrderedDictionary<Int, Int> subscript, _modify",
|
||||
@@ -173,7 +173,7 @@
|
||||
"kind": "chart",
|
||||
"title": "index(forKey:), successful index(forKey:)",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> successful index(forKey:)",
|
||||
"TreeDictionary<Int, Int> successful index(forKey:)",
|
||||
"Dictionary<Int, Int> successful index(forKey:)",
|
||||
"OrderedDictionary<Int, Int> successful index(forKey:)",
|
||||
]
|
||||
@@ -182,7 +182,7 @@
|
||||
"kind": "chart",
|
||||
"title": "index(forKey:), unsuccessful index(forKey:)",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"TreeDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"Dictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"OrderedDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
]
|
||||
@@ -191,7 +191,7 @@
|
||||
"kind": "chart",
|
||||
"title": "updateValue(_:forKey:), existing",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
"TreeDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
"Dictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
"OrderedDictionary<Int, Int> updateValue(_:forKey:), existing"
|
||||
]
|
||||
@@ -200,7 +200,7 @@
|
||||
"kind": "chart",
|
||||
"title": "updateValue(_:forKey:), insert",
|
||||
"tasks": [
|
||||
"ShareableDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"TreeDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"Dictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"OrderedDictionary<Int, Int> updateValue(_:forKey:), append"
|
||||
]
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"kind": "group",
|
||||
"title": "ShareableSet Benchmarks",
|
||||
"directory": "ShareableSet",
|
||||
"title": "TreeSet Benchmarks",
|
||||
"directory": "TreeSet",
|
||||
"contents": [
|
||||
{
|
||||
"kind": "group",
|
||||
@@ -12,21 +12,21 @@
|
||||
"kind": "chart",
|
||||
"title": "operations",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> init from range",
|
||||
"ShareableSet<Int> init from unsafe buffer",
|
||||
"ShareableSet<Int> sequential iteration",
|
||||
"ShareableSet<Int> successful contains",
|
||||
"ShareableSet<Int> unsuccessful contains",
|
||||
"ShareableSet<Int> insert",
|
||||
"ShareableSet<Int> remove"
|
||||
"TreeSet<Int> init from range",
|
||||
"TreeSet<Int> init from unsafe buffer",
|
||||
"TreeSet<Int> sequential iteration",
|
||||
"TreeSet<Int> successful contains",
|
||||
"TreeSet<Int> unsuccessful contains",
|
||||
"TreeSet<Int> insert",
|
||||
"TreeSet<Int> remove"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "initializers",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> init from range",
|
||||
"ShareableSet<Int> init from unsafe buffer",
|
||||
"TreeSet<Int> init from range",
|
||||
"TreeSet<Int> init from unsafe buffer",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -36,66 +36,66 @@
|
||||
"kind": "chart",
|
||||
"title": "union with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "union with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> union with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> union with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> union with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> union with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> union with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> union with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> union with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> union with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> union with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "union with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Array (0% overlap)",
|
||||
"ShareableSet<Int> union with Array (25% overlap)",
|
||||
"ShareableSet<Int> union with Array (50% overlap)",
|
||||
"ShareableSet<Int> union with Array (75% overlap)",
|
||||
"ShareableSet<Int> union with Array (100% overlap)",
|
||||
"TreeSet<Int> union with Array (0% overlap)",
|
||||
"TreeSet<Int> union with Array (25% overlap)",
|
||||
"TreeSet<Int> union with Array (50% overlap)",
|
||||
"TreeSet<Int> union with Array (75% overlap)",
|
||||
"TreeSet<Int> union with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formUnion with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formUnion with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formUnion with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Array (0% overlap)",
|
||||
"ShareableSet<Int> formUnion with Array (25% overlap)",
|
||||
"ShareableSet<Int> formUnion with Array (50% overlap)",
|
||||
"ShareableSet<Int> formUnion with Array (75% overlap)",
|
||||
"ShareableSet<Int> formUnion with Array (100% overlap)",
|
||||
"TreeSet<Int> formUnion with Array (0% overlap)",
|
||||
"TreeSet<Int> formUnion with Array (25% overlap)",
|
||||
"TreeSet<Int> formUnion with Array (50% overlap)",
|
||||
"TreeSet<Int> formUnion with Array (75% overlap)",
|
||||
"TreeSet<Int> formUnion with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
]
|
||||
@@ -107,66 +107,66 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "intersection with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "intersection with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Array (0% overlap)",
|
||||
"ShareableSet<Int> intersection with Array (25% overlap)",
|
||||
"ShareableSet<Int> intersection with Array (50% overlap)",
|
||||
"ShareableSet<Int> intersection with Array (75% overlap)",
|
||||
"ShareableSet<Int> intersection with Array (100% overlap)",
|
||||
"TreeSet<Int> intersection with Array (0% overlap)",
|
||||
"TreeSet<Int> intersection with Array (25% overlap)",
|
||||
"TreeSet<Int> intersection with Array (50% overlap)",
|
||||
"TreeSet<Int> intersection with Array (75% overlap)",
|
||||
"TreeSet<Int> intersection with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formIntersection with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formIntersection with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formIntersection with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Array (0% overlap)",
|
||||
"ShareableSet<Int> formIntersection with Array (25% overlap)",
|
||||
"ShareableSet<Int> formIntersection with Array (50% overlap)",
|
||||
"ShareableSet<Int> formIntersection with Array (75% overlap)",
|
||||
"ShareableSet<Int> formIntersection with Array (100% overlap)",
|
||||
"TreeSet<Int> formIntersection with Array (0% overlap)",
|
||||
"TreeSet<Int> formIntersection with Array (25% overlap)",
|
||||
"TreeSet<Int> formIntersection with Array (50% overlap)",
|
||||
"TreeSet<Int> formIntersection with Array (75% overlap)",
|
||||
"TreeSet<Int> formIntersection with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
]
|
||||
@@ -178,66 +178,66 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Array (0% overlap)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (25% overlap)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (50% overlap)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (75% overlap)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (100% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Array (0% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Array (25% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Array (50% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Array (75% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference with Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference with Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (0% overlap)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (25% overlap)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (50% overlap)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (75% overlap)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (100% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (0% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (25% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (50% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (75% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
]
|
||||
@@ -249,66 +249,66 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "subtracting Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Self (100% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Self (0% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Self (25% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Self (50% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Self (75% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "subtracting Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Array (0% overlap)",
|
||||
"ShareableSet<Int> subtracting Array (25% overlap)",
|
||||
"ShareableSet<Int> subtracting Array (50% overlap)",
|
||||
"ShareableSet<Int> subtracting Array (75% overlap)",
|
||||
"ShareableSet<Int> subtracting Array (100% overlap)",
|
||||
"TreeSet<Int> subtracting Array (0% overlap)",
|
||||
"TreeSet<Int> subtracting Array (25% overlap)",
|
||||
"TreeSet<Int> subtracting Array (50% overlap)",
|
||||
"TreeSet<Int> subtracting Array (75% overlap)",
|
||||
"TreeSet<Int> subtracting Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "subtract Self, distinct",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (100% overlap, distinct)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "subtract Self, shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Self (100% overlap, shared)",
|
||||
"TreeSet<Int> subtract Self (0% overlap, shared)",
|
||||
"TreeSet<Int> subtract Self (25% overlap, shared)",
|
||||
"TreeSet<Int> subtract Self (50% overlap, shared)",
|
||||
"TreeSet<Int> subtract Self (75% overlap, shared)",
|
||||
"TreeSet<Int> subtract Self (100% overlap, shared)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "subtract with Array",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Array (0% overlap)",
|
||||
"ShareableSet<Int> subtract Array (25% overlap)",
|
||||
"ShareableSet<Int> subtract Array (50% overlap)",
|
||||
"ShareableSet<Int> subtract Array (75% overlap)",
|
||||
"ShareableSet<Int> subtract Array (100% overlap)",
|
||||
"TreeSet<Int> subtract Array (0% overlap)",
|
||||
"TreeSet<Int> subtract Array (25% overlap)",
|
||||
"TreeSet<Int> subtract Array (50% overlap)",
|
||||
"TreeSet<Int> subtract Array (75% overlap)",
|
||||
"TreeSet<Int> subtract Array (100% overlap)",
|
||||
]
|
||||
},
|
||||
]
|
||||
@@ -324,7 +324,7 @@
|
||||
"kind": "chart",
|
||||
"title": "init from buffer of integers",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> init from unsafe buffer",
|
||||
"TreeSet<Int> init from unsafe buffer",
|
||||
"Set<Int> init from unsafe buffer",
|
||||
]
|
||||
},
|
||||
@@ -332,7 +332,7 @@
|
||||
"kind": "chart",
|
||||
"title": "init from range of integers",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> init from range",
|
||||
"TreeSet<Int> init from range",
|
||||
"Set<Int> init from range",
|
||||
]
|
||||
},
|
||||
@@ -340,7 +340,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> sequential iteration",
|
||||
"TreeSet<Int> sequential iteration",
|
||||
"Set<Int> sequential iteration",
|
||||
]
|
||||
},
|
||||
@@ -348,7 +348,7 @@
|
||||
"kind": "chart",
|
||||
"title": "sequential iteration using indices",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> sequential iteration, indices",
|
||||
"TreeSet<Int> sequential iteration, indices",
|
||||
"Set<Int> sequential iteration, indices",
|
||||
]
|
||||
},
|
||||
@@ -356,7 +356,7 @@
|
||||
"kind": "chart",
|
||||
"title": "successful random lookups",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> successful contains",
|
||||
"TreeSet<Int> successful contains",
|
||||
"Set<Int> successful contains",
|
||||
]
|
||||
},
|
||||
@@ -364,7 +364,7 @@
|
||||
"kind": "chart",
|
||||
"title": "unsuccessful random lookups",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> unsuccessful contains",
|
||||
"TreeSet<Int> unsuccessful contains",
|
||||
"Set<Int> unsuccessful contains",
|
||||
]
|
||||
},
|
||||
@@ -372,7 +372,7 @@
|
||||
"kind": "chart",
|
||||
"title": "insert",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> insert",
|
||||
"TreeSet<Int> insert",
|
||||
"Set<Int> insert",
|
||||
"Set<Int> insert, reserving capacity",
|
||||
]
|
||||
@@ -381,7 +381,7 @@
|
||||
"kind": "chart",
|
||||
"title": "insert-shared",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> insert, shared",
|
||||
"TreeSet<Int> insert, shared",
|
||||
"Set<Int> insert, shared",
|
||||
]
|
||||
},
|
||||
@@ -389,7 +389,7 @@
|
||||
"kind": "chart",
|
||||
"title": "model building with constant diffing",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> model diffing",
|
||||
"TreeSet<Int> model diffing",
|
||||
"Set<Int> model diffing"
|
||||
]
|
||||
},
|
||||
@@ -397,8 +397,8 @@
|
||||
"kind": "chart",
|
||||
"title": "remove",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> remove",
|
||||
"ShareableSet<Int> remove, shared",
|
||||
"TreeSet<Int> remove",
|
||||
"TreeSet<Int> remove, shared",
|
||||
"Set<Int> remove",
|
||||
"Set<Int> remove, shared",
|
||||
]
|
||||
@@ -410,9 +410,9 @@
|
||||
"kind": "chart",
|
||||
"title": "union (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> union with Array (0% overlap)",
|
||||
"TreeSet<Int> union with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> union with Array (0% overlap)",
|
||||
"Set<Int> union with Self (0% overlap)",
|
||||
"Set<Int> union with Array (0% overlap)",
|
||||
]
|
||||
@@ -421,9 +421,9 @@
|
||||
"kind": "chart",
|
||||
"title": "union (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> union with Array (25% overlap)",
|
||||
"TreeSet<Int> union with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> union with Array (25% overlap)",
|
||||
"Set<Int> union with Self (25% overlap)",
|
||||
"Set<Int> union with Array (25% overlap)",
|
||||
]
|
||||
@@ -432,9 +432,9 @@
|
||||
"kind": "chart",
|
||||
"title": "union (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> union with Array (50% overlap)",
|
||||
"TreeSet<Int> union with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> union with Array (50% overlap)",
|
||||
"Set<Int> union with Self (50% overlap)",
|
||||
"Set<Int> union with Array (50% overlap)",
|
||||
]
|
||||
@@ -443,9 +443,9 @@
|
||||
"kind": "chart",
|
||||
"title": "union (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> union with Array (75% overlap)",
|
||||
"TreeSet<Int> union with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> union with Array (75% overlap)",
|
||||
"Set<Int> union with Self (75% overlap)",
|
||||
"Set<Int> union with Array (75% overlap)",
|
||||
]
|
||||
@@ -454,9 +454,9 @@
|
||||
"kind": "chart",
|
||||
"title": "union (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> union with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> union with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> union with Array (100% overlap)",
|
||||
"TreeSet<Int> union with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> union with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> union with Array (100% overlap)",
|
||||
"Set<Int> union with Self (100% overlap)",
|
||||
"Set<Int> union with Array (100% overlap)",
|
||||
]
|
||||
@@ -470,9 +470,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formUnion (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Array (0% overlap)",
|
||||
"TreeSet<Int> formUnion with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Array (0% overlap)",
|
||||
"Set<Int> formUnion with Self (0% overlap)",
|
||||
"Set<Int> formUnion with Array (0% overlap)",
|
||||
]
|
||||
@@ -481,9 +481,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formUnion (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Array (25% overlap)",
|
||||
"TreeSet<Int> formUnion with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Array (25% overlap)",
|
||||
"Set<Int> formUnion with Self (25% overlap)",
|
||||
"Set<Int> formUnion with Array (25% overlap)",
|
||||
]
|
||||
@@ -492,9 +492,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formUnion (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Array (50% overlap)",
|
||||
"TreeSet<Int> formUnion with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Array (50% overlap)",
|
||||
"Set<Int> formUnion with Self (50% overlap)",
|
||||
"Set<Int> formUnion with Array (50% overlap)",
|
||||
]
|
||||
@@ -503,9 +503,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formUnion (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Array (75% overlap)",
|
||||
"TreeSet<Int> formUnion with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Array (75% overlap)",
|
||||
"Set<Int> formUnion with Self (75% overlap)",
|
||||
"Set<Int> formUnion with Array (75% overlap)",
|
||||
]
|
||||
@@ -514,9 +514,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formUnion (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formUnion with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> formUnion with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> formUnion with Array (100% overlap)",
|
||||
"TreeSet<Int> formUnion with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formUnion with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formUnion with Array (100% overlap)",
|
||||
"Set<Int> formUnion with Self (100% overlap)",
|
||||
"Set<Int> formUnion with Array (100% overlap)",
|
||||
]
|
||||
@@ -530,9 +530,9 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Array (0% overlap)",
|
||||
"TreeSet<Int> intersection with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Array (0% overlap)",
|
||||
"Set<Int> intersection with Self (0% overlap)",
|
||||
"Set<Int> intersection with Array (0% overlap)",
|
||||
]
|
||||
@@ -541,9 +541,9 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Array (25% overlap)",
|
||||
"TreeSet<Int> intersection with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Array (25% overlap)",
|
||||
"Set<Int> intersection with Self (25% overlap)",
|
||||
"Set<Int> intersection with Array (25% overlap)",
|
||||
]
|
||||
@@ -552,9 +552,9 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Array (50% overlap)",
|
||||
"TreeSet<Int> intersection with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Array (50% overlap)",
|
||||
"Set<Int> intersection with Self (50% overlap)",
|
||||
"Set<Int> intersection with Array (50% overlap)",
|
||||
]
|
||||
@@ -563,9 +563,9 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Array (75% overlap)",
|
||||
"TreeSet<Int> intersection with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Array (75% overlap)",
|
||||
"Set<Int> intersection with Self (75% overlap)",
|
||||
"Set<Int> intersection with Array (75% overlap)",
|
||||
]
|
||||
@@ -574,9 +574,9 @@
|
||||
"kind": "chart",
|
||||
"title": "intersection (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> intersection with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> intersection with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> intersection with Array (100% overlap)",
|
||||
"TreeSet<Int> intersection with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> intersection with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> intersection with Array (100% overlap)",
|
||||
"Set<Int> intersection with Self (100% overlap)",
|
||||
"Set<Int> intersection with Array (100% overlap)",
|
||||
]
|
||||
@@ -590,9 +590,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formIntersection (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Array (0% overlap)",
|
||||
"TreeSet<Int> formIntersection with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Array (0% overlap)",
|
||||
"Set<Int> formIntersection with Self (0% overlap)",
|
||||
"Set<Int> formIntersection with Array (0% overlap)",
|
||||
]
|
||||
@@ -601,9 +601,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formIntersection (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Array (25% overlap)",
|
||||
"TreeSet<Int> formIntersection with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Array (25% overlap)",
|
||||
"Set<Int> formIntersection with Self (25% overlap)",
|
||||
"Set<Int> formIntersection with Array (25% overlap)",
|
||||
]
|
||||
@@ -612,9 +612,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formIntersection (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Array (50% overlap)",
|
||||
"TreeSet<Int> formIntersection with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Array (50% overlap)",
|
||||
"Set<Int> formIntersection with Self (50% overlap)",
|
||||
"Set<Int> formIntersection with Array (50% overlap)",
|
||||
]
|
||||
@@ -623,9 +623,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formIntersection (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Array (75% overlap)",
|
||||
"TreeSet<Int> formIntersection with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Array (75% overlap)",
|
||||
"Set<Int> formIntersection with Self (75% overlap)",
|
||||
"Set<Int> formIntersection with Array (75% overlap)",
|
||||
]
|
||||
@@ -634,9 +634,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formIntersection (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formIntersection with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> formIntersection with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> formIntersection with Array (100% overlap)",
|
||||
"TreeSet<Int> formIntersection with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formIntersection with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formIntersection with Array (100% overlap)",
|
||||
"Set<Int> formIntersection with Self (100% overlap)",
|
||||
"Set<Int> formIntersection with Array (100% overlap)",
|
||||
]
|
||||
@@ -650,9 +650,9 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (0% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Array (0% overlap)",
|
||||
"Set<Int> symmetricDifference with Self (0% overlap)",
|
||||
"Set<Int> symmetricDifference with Array (0% overlap)",
|
||||
]
|
||||
@@ -661,9 +661,9 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (25% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Array (25% overlap)",
|
||||
"Set<Int> symmetricDifference with Self (25% overlap)",
|
||||
"Set<Int> symmetricDifference with Array (25% overlap)",
|
||||
]
|
||||
@@ -672,9 +672,9 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (50% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Array (50% overlap)",
|
||||
"Set<Int> symmetricDifference with Self (50% overlap)",
|
||||
"Set<Int> symmetricDifference with Array (50% overlap)",
|
||||
]
|
||||
@@ -683,9 +683,9 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (75% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Array (75% overlap)",
|
||||
"Set<Int> symmetricDifference with Self (75% overlap)",
|
||||
"Set<Int> symmetricDifference with Array (75% overlap)",
|
||||
]
|
||||
@@ -694,9 +694,9 @@
|
||||
"kind": "chart",
|
||||
"title": "symmetricDifference (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> symmetricDifference with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> symmetricDifference with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> symmetricDifference with Array (100% overlap)",
|
||||
"TreeSet<Int> symmetricDifference with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> symmetricDifference with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> symmetricDifference with Array (100% overlap)",
|
||||
"Set<Int> symmetricDifference with Self (100% overlap)",
|
||||
"Set<Int> symmetricDifference with Array (100% overlap)",
|
||||
]
|
||||
@@ -710,9 +710,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (0% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (0% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (0% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Self (0% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Array (0% overlap)",
|
||||
]
|
||||
@@ -721,9 +721,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (25% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (25% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (25% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Self (25% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Array (25% overlap)",
|
||||
]
|
||||
@@ -732,9 +732,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (50% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (50% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (50% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Self (50% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Array (50% overlap)",
|
||||
]
|
||||
@@ -743,9 +743,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (75% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (75% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (75% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Self (75% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Array (75% overlap)",
|
||||
]
|
||||
@@ -754,9 +754,9 @@
|
||||
"kind": "chart",
|
||||
"title": "formSymmetricDifference (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> formSymmetricDifference with Array (100% overlap)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> formSymmetricDifference with Self (100% overlap, shared)",
|
||||
"TreeSet<Int> formSymmetricDifference with Array (100% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Self (100% overlap)",
|
||||
"Set<Int> formSymmetricDifference with Array (100% overlap)",
|
||||
]
|
||||
@@ -770,9 +770,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Array (0% overlap)",
|
||||
"TreeSet<Int> subtracting Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (0% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Array (0% overlap)",
|
||||
"Set<Int> subtracting Self (0% overlap)",
|
||||
"Set<Int> subtracting Array (0% overlap)",
|
||||
]
|
||||
@@ -781,9 +781,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Array (25% overlap)",
|
||||
"TreeSet<Int> subtracting Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (25% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Array (25% overlap)",
|
||||
"Set<Int> subtracting Self (25% overlap)",
|
||||
"Set<Int> subtracting Array (25% overlap)",
|
||||
]
|
||||
@@ -792,9 +792,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Array (50% overlap)",
|
||||
"TreeSet<Int> subtracting Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (50% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Array (50% overlap)",
|
||||
"Set<Int> subtracting Self (50% overlap)",
|
||||
"Set<Int> subtracting Array (50% overlap)",
|
||||
]
|
||||
@@ -803,9 +803,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Array (75% overlap)",
|
||||
"TreeSet<Int> subtracting Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (75% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Array (75% overlap)",
|
||||
"Set<Int> subtracting Self (75% overlap)",
|
||||
"Set<Int> subtracting Array (75% overlap)",
|
||||
]
|
||||
@@ -814,9 +814,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtracting (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtracting Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> subtracting Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> subtracting Array (100% overlap)",
|
||||
"TreeSet<Int> subtracting Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> subtracting Self (100% overlap, shared)",
|
||||
"TreeSet<Int> subtracting Array (100% overlap)",
|
||||
"Set<Int> subtracting Self (100% overlap)",
|
||||
"Set<Int> subtracting Array (100% overlap)",
|
||||
]
|
||||
@@ -830,9 +830,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtract (0% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (0% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (0% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Array (0% overlap)",
|
||||
"TreeSet<Int> subtract Self (0% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (0% overlap, shared)",
|
||||
"TreeSet<Int> subtract Array (0% overlap)",
|
||||
"Set<Int> subtract Self (0% overlap)",
|
||||
"Set<Int> subtract Array (0% overlap)",
|
||||
]
|
||||
@@ -841,9 +841,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtract (25% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (25% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (25% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Array (25% overlap)",
|
||||
"TreeSet<Int> subtract Self (25% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (25% overlap, shared)",
|
||||
"TreeSet<Int> subtract Array (25% overlap)",
|
||||
"Set<Int> subtract Self (25% overlap)",
|
||||
"Set<Int> subtract Array (25% overlap)",
|
||||
]
|
||||
@@ -852,9 +852,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtract (50% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (50% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (50% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Array (50% overlap)",
|
||||
"TreeSet<Int> subtract Self (50% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (50% overlap, shared)",
|
||||
"TreeSet<Int> subtract Array (50% overlap)",
|
||||
"Set<Int> subtract Self (50% overlap)",
|
||||
"Set<Int> subtract Array (50% overlap)",
|
||||
]
|
||||
@@ -863,9 +863,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtract (75% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (75% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (75% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Array (75% overlap)",
|
||||
"TreeSet<Int> subtract Self (75% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (75% overlap, shared)",
|
||||
"TreeSet<Int> subtract Array (75% overlap)",
|
||||
"Set<Int> subtract Self (75% overlap)",
|
||||
"Set<Int> subtract Array (75% overlap)",
|
||||
]
|
||||
@@ -874,9 +874,9 @@
|
||||
"kind": "chart",
|
||||
"title": "subtract (100% overlap)",
|
||||
"tasks": [
|
||||
"ShareableSet<Int> subtract Self (100% overlap, distinct)",
|
||||
"ShareableSet<Int> subtract Self (100% overlap, shared)",
|
||||
"ShareableSet<Int> subtract Array (100% overlap)",
|
||||
"TreeSet<Int> subtract Self (100% overlap, distinct)",
|
||||
"TreeSet<Int> subtract Self (100% overlap, shared)",
|
||||
"TreeSet<Int> subtract Array (100% overlap)",
|
||||
"Set<Int> subtract Self (100% overlap)",
|
||||
"Set<Int> subtract Array (100% overlap)",
|
||||
]
|
||||
@@ -10,25 +10,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CollectionsBenchmark
|
||||
import ShareableHashedCollections
|
||||
import HashTreeCollections
|
||||
|
||||
extension Benchmark {
|
||||
public mutating func addShareableDictionaryBenchmarks() {
|
||||
public mutating func addTreeDictionaryBenchmarks() {
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
title: "TreeDictionary<Int, Int> init(uniqueKeysWithValues:)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let keysAndValues = input.map { ($0, 2 * $0) }
|
||||
return { timer in
|
||||
blackHole(ShareableDictionary(uniqueKeysWithValues: keysAndValues))
|
||||
blackHole(TreeDictionary(uniqueKeysWithValues: keysAndValues))
|
||||
}
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> sequential iteration",
|
||||
title: "TreeDictionary<Int, Int> sequential iteration",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for item in d {
|
||||
blackHole(item)
|
||||
@@ -37,10 +37,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int>.Keys sequential iteration",
|
||||
title: "TreeDictionary<Int, Int>.Keys sequential iteration",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for item in d.keys {
|
||||
blackHole(item)
|
||||
@@ -49,10 +49,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int>.Values sequential iteration",
|
||||
title: "TreeDictionary<Int, Int>.Values sequential iteration",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for item in d.values {
|
||||
blackHole(item)
|
||||
@@ -61,10 +61,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> sequential iteration, indices",
|
||||
title: "TreeDictionary<Int, Int> sequential iteration, indices",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in d.indices {
|
||||
blackHole(d[i])
|
||||
@@ -73,10 +73,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> striding, 10 steps",
|
||||
title: "TreeDictionary<Int, Int> striding, 10 steps",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let d = ShareableDictionary(
|
||||
let d = TreeDictionary(
|
||||
uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let steps = stride(from: 0, through: 10 * d.count, by: d.count)
|
||||
.map { $0 / 10 }
|
||||
@@ -92,10 +92,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> indexing subscript",
|
||||
title: "TreeDictionary<Int, Int> indexing subscript",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let indices = lookups.map { d.index(forKey: $0)! }
|
||||
return { timer in
|
||||
for i in indices {
|
||||
@@ -105,10 +105,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, successful lookups",
|
||||
title: "TreeDictionary<Int, Int> subscript, successful lookups",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d[i] == 2 * i)
|
||||
@@ -117,10 +117,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
title: "TreeDictionary<Int, Int> subscript, unsuccessful lookups",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let c = input.count
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
@@ -130,11 +130,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, noop setter",
|
||||
title: "TreeDictionary<Int, Int> subscript, noop setter",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let c = input.count
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
@@ -147,11 +147,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, set existing",
|
||||
title: "TreeDictionary<Int, Int> subscript, set existing",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
d[i] = 0
|
||||
@@ -163,11 +163,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, _modify",
|
||||
title: "TreeDictionary<Int, Int> subscript, _modify",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
d[i]! *= 2
|
||||
@@ -179,10 +179,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableDictionary<Int, Int> subscript, insert, unique",
|
||||
title: "TreeDictionary<Int, Int> subscript, insert, unique",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
var d: ShareableDictionary<Int, Int> = [:]
|
||||
var d: TreeDictionary<Int, Int> = [:]
|
||||
for i in input {
|
||||
d[i] = 2 * i
|
||||
}
|
||||
@@ -191,10 +191,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableDictionary<Int, Int> subscript, insert, shared",
|
||||
title: "TreeDictionary<Int, Int> subscript, insert, shared",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
var d: ShareableDictionary<Int, Int> = [:]
|
||||
var d: TreeDictionary<Int, Int> = [:]
|
||||
for i in input {
|
||||
let copy = d
|
||||
d[i] = 2 * i
|
||||
@@ -205,11 +205,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, remove existing, unique",
|
||||
title: "TreeDictionary<Int, Int> subscript, remove existing, unique",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
d[i] = nil
|
||||
@@ -221,11 +221,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, remove existing, shared",
|
||||
title: "TreeDictionary<Int, Int> subscript, remove existing, shared",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
let copy = d
|
||||
@@ -239,11 +239,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> subscript, remove missing",
|
||||
title: "TreeDictionary<Int, Int> subscript, remove missing",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let c = input.count
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
@@ -256,10 +256,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> defaulted subscript, successful lookups",
|
||||
title: "TreeDictionary<Int, Int> defaulted subscript, successful lookups",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d[i, default: -1] != -1)
|
||||
@@ -268,10 +268,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> defaulted subscript, unsuccessful lookups",
|
||||
title: "TreeDictionary<Int, Int> defaulted subscript, unsuccessful lookups",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
let c = d.count
|
||||
for i in lookups {
|
||||
@@ -281,11 +281,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
title: "TreeDictionary<Int, Int> defaulted subscript, _modify existing",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in input {
|
||||
d[i, default: -1] *= 2
|
||||
@@ -297,11 +297,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> defaulted subscript, _modify missing",
|
||||
title: "TreeDictionary<Int, Int> defaulted subscript, _modify missing",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let c = input.count
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
@@ -314,10 +314,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> successful index(forKey:)",
|
||||
title: "TreeDictionary<Int, Int> successful index(forKey:)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d.index(forKey: i) != nil)
|
||||
@@ -326,10 +326,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
title: "TreeDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
let d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d.index(forKey: lookups.count + i) == nil)
|
||||
@@ -338,11 +338,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
title: "TreeDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
d.updateValue(0, forKey: i)
|
||||
@@ -354,11 +354,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
title: "TreeDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
d.updateValue(0, forKey: input.count + i)
|
||||
@@ -370,11 +370,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> random removals (existing keys)",
|
||||
title: "TreeDictionary<Int, Int> random removals (existing keys)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
precondition(d.removeValue(forKey: i) != nil)
|
||||
@@ -386,12 +386,12 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Int, Int> random removals (missing keys)",
|
||||
title: "TreeDictionary<Int, Int> random removals (missing keys)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
let c = input.count
|
||||
var d = ShareableDictionary(uniqueKeysWithValues: input.lazy.map { (c + $0, 2 * $0) })
|
||||
var d = TreeDictionary(uniqueKeysWithValues: input.lazy.map { (c + $0, 2 * $0) })
|
||||
timer.measure {
|
||||
for i in lookups {
|
||||
precondition(d.removeValue(forKey: i) == nil)
|
||||
@@ -403,11 +403,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Large, Large> subscript, insert, unique",
|
||||
title: "TreeDictionary<Large, Large> subscript, insert, unique",
|
||||
input: [Large].self
|
||||
) { input in
|
||||
return { timer in
|
||||
var d: ShareableDictionary<Large, Large> = [:]
|
||||
var d: TreeDictionary<Large, Large> = [:]
|
||||
timer.measure {
|
||||
for value in input {
|
||||
d[value] = value
|
||||
@@ -419,11 +419,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Large, Large> subscript, insert, shared",
|
||||
title: "TreeDictionary<Large, Large> subscript, insert, shared",
|
||||
input: [Large].self
|
||||
) { input in
|
||||
return { timer in
|
||||
var d: ShareableDictionary<Large, Large> = [:]
|
||||
var d: TreeDictionary<Large, Large> = [:]
|
||||
timer.measure {
|
||||
for value in input {
|
||||
let copy = d
|
||||
@@ -437,11 +437,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Large, Large> subscript, remove existing, unique",
|
||||
title: "TreeDictionary<Large, Large> subscript, remove existing, unique",
|
||||
input: ([Large], [Large]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(
|
||||
var d = TreeDictionary(
|
||||
uniqueKeysWithValues: input.lazy.map { ($0, $0) })
|
||||
timer.measure {
|
||||
for key in lookups {
|
||||
@@ -454,11 +454,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableDictionary<Large, Large> subscript, remove existing, shared",
|
||||
title: "TreeDictionary<Large, Large> subscript, remove existing, shared",
|
||||
input: ([Large], [Large]).self
|
||||
) { input, lookups in
|
||||
return { timer in
|
||||
var d = ShareableDictionary(
|
||||
var d = TreeDictionary(
|
||||
uniqueKeysWithValues: input.lazy.map { ($0, $0) })
|
||||
timer.measure {
|
||||
for key in lookups {
|
||||
|
||||
@@ -10,31 +10,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CollectionsBenchmark
|
||||
import ShareableHashedCollections
|
||||
import HashTreeCollections
|
||||
|
||||
extension Benchmark {
|
||||
public mutating func addShareableSetBenchmarks() {
|
||||
public mutating func addTreeSetBenchmarks() {
|
||||
self.addSimple(
|
||||
title: "ShareableSet<Int> init from range",
|
||||
title: "TreeSet<Int> init from range",
|
||||
input: Int.self
|
||||
) { size in
|
||||
blackHole(ShareableSet(0 ..< size))
|
||||
blackHole(TreeSet(0 ..< size))
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableSet<Int> init from unsafe buffer",
|
||||
title: "TreeSet<Int> init from unsafe buffer",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
input.withUnsafeBufferPointer { buffer in
|
||||
blackHole(ShareableSet(buffer))
|
||||
blackHole(TreeSet(buffer))
|
||||
}
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> sequential iteration",
|
||||
title: "TreeSet<Int> sequential iteration",
|
||||
input: Int.self
|
||||
) { size in
|
||||
let set = ShareableSet(0 ..< size)
|
||||
let set = TreeSet(0 ..< size)
|
||||
return { timer in
|
||||
for i in set {
|
||||
blackHole(i)
|
||||
@@ -43,10 +43,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> sequential iteration, indices",
|
||||
title: "TreeSet<Int> sequential iteration, indices",
|
||||
input: Int.self
|
||||
) { size in
|
||||
let set = ShareableSet(0 ..< size)
|
||||
let set = TreeSet(0 ..< size)
|
||||
return { timer in
|
||||
for i in set.indices {
|
||||
blackHole(set[i])
|
||||
@@ -55,10 +55,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> successful contains",
|
||||
title: "TreeSet<Int> successful contains",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let set = ShareableSet(input)
|
||||
let set = TreeSet(input)
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(set.contains(i))
|
||||
@@ -67,10 +67,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> unsuccessful contains",
|
||||
title: "TreeSet<Int> unsuccessful contains",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let set = ShareableSet(input)
|
||||
let set = TreeSet(input)
|
||||
let lookups = lookups.map { $0 + input.count }
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
@@ -80,10 +80,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableSet<Int> insert",
|
||||
title: "TreeSet<Int> insert",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
var set: ShareableSet<Int> = []
|
||||
var set: TreeSet<Int> = []
|
||||
for i in input {
|
||||
set.insert(i)
|
||||
}
|
||||
@@ -92,10 +92,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableSet<Int> insert, shared",
|
||||
title: "TreeSet<Int> insert, shared",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
var set: ShareableSet<Int> = []
|
||||
var set: TreeSet<Int> = []
|
||||
for i in input {
|
||||
let copy = set
|
||||
set.insert(i)
|
||||
@@ -106,10 +106,10 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.addSimple(
|
||||
title: "ShareableSet<Int> model diffing",
|
||||
title: "TreeSet<Int> model diffing",
|
||||
input: Int.self
|
||||
) { input in
|
||||
typealias Model = ShareableSet<Int>
|
||||
typealias Model = TreeSet<Int>
|
||||
|
||||
var _state: Model = [] // Private
|
||||
func updateState(
|
||||
@@ -130,11 +130,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> remove",
|
||||
title: "TreeSet<Int> remove",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, removals in
|
||||
return { timer in
|
||||
var set = ShareableSet(input)
|
||||
var set = TreeSet(input)
|
||||
for i in removals {
|
||||
set.remove(i)
|
||||
}
|
||||
@@ -144,11 +144,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> remove, shared",
|
||||
title: "TreeSet<Int> remove, shared",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, removals in
|
||||
return { timer in
|
||||
var set = ShareableSet(input)
|
||||
var set = TreeSet(input)
|
||||
for i in removals {
|
||||
let copy = set
|
||||
set.remove(i)
|
||||
@@ -170,10 +170,10 @@ extension Benchmark {
|
||||
// SetAlgebra operations with Self
|
||||
do {
|
||||
func makeB(
|
||||
_ a: ShareableSet<Int>, _ range: Range<Int>, shared: Bool
|
||||
) -> ShareableSet<Int> {
|
||||
_ a: TreeSet<Int>, _ range: Range<Int>, shared: Bool
|
||||
) -> TreeSet<Int> {
|
||||
guard shared else {
|
||||
return ShareableSet(range)
|
||||
return TreeSet(range)
|
||||
}
|
||||
var b = a
|
||||
b.subtract(0 ..< range.lowerBound)
|
||||
@@ -186,11 +186,11 @@ extension Benchmark {
|
||||
let qualifier = "\(percentage) overlap, \(shared ? "shared" : "distinct")"
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> union with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> union with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
return { timer in
|
||||
blackHole(a.union(identity(b)))
|
||||
@@ -198,11 +198,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> intersection with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> intersection with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
return { timer in
|
||||
blackHole(a.intersection(identity(b)))
|
||||
@@ -210,11 +210,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> symmetricDifference with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> symmetricDifference with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
return { timer in
|
||||
blackHole(a.symmetricDifference(identity(b)))
|
||||
@@ -222,11 +222,11 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> subtracting Self (\(qualifier))",
|
||||
title: "TreeSet<Int> subtracting Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
return { timer in
|
||||
blackHole(a.subtracting(identity(b)))
|
||||
@@ -240,11 +240,11 @@ extension Benchmark {
|
||||
do {
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> union with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> union with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
blackHole(a.union(identity(b)))
|
||||
@@ -254,11 +254,11 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> intersection with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> intersection with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
blackHole(a.intersection(identity(b)))
|
||||
@@ -268,11 +268,11 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> symmetricDifference with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> symmetricDifference with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
blackHole(a.symmetricDifference(identity(b)))
|
||||
@@ -282,11 +282,11 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> subtracting Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> subtracting Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let a = ShareableSet(input)
|
||||
let a = TreeSet(input)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
blackHole(a.subtracting(identity(b)))
|
||||
@@ -298,10 +298,10 @@ extension Benchmark {
|
||||
// SetAlgebra mutations with Self
|
||||
do {
|
||||
func makeB(
|
||||
_ a: ShareableSet<Int>, _ range: Range<Int>, shared: Bool
|
||||
) -> ShareableSet<Int> {
|
||||
_ a: TreeSet<Int>, _ range: Range<Int>, shared: Bool
|
||||
) -> TreeSet<Int> {
|
||||
guard shared else {
|
||||
return ShareableSet(range)
|
||||
return TreeSet(range)
|
||||
}
|
||||
var b = a
|
||||
b.subtract(0 ..< range.lowerBound)
|
||||
@@ -314,12 +314,12 @@ extension Benchmark {
|
||||
let qualifier = "\(percentage) overlap, \(shared ? "shared" : "distinct")"
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formUnion with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> formUnion with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
timer.measure {
|
||||
a.formUnion(identity(b))
|
||||
@@ -329,12 +329,12 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formIntersection with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> formIntersection with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
timer.measure {
|
||||
a.formIntersection(identity(b))
|
||||
@@ -344,12 +344,12 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formSymmetricDifference with Self (\(qualifier))",
|
||||
title: "TreeSet<Int> formSymmetricDifference with Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
timer.measure {
|
||||
a.formSymmetricDifference(identity(b))
|
||||
@@ -359,12 +359,12 @@ extension Benchmark {
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "ShareableSet<Int> subtract Self (\(qualifier))",
|
||||
title: "TreeSet<Int> subtract Self (\(qualifier))",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
let b = makeB(a, start ..< start + input.count, shared: shared)
|
||||
timer.measure {
|
||||
a.subtract(identity(b))
|
||||
@@ -380,13 +380,13 @@ extension Benchmark {
|
||||
do {
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formUnion with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> formUnion with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
timer.measure {
|
||||
a.formUnion(identity(b))
|
||||
}
|
||||
@@ -397,13 +397,13 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formIntersection with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> formIntersection with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
timer.measure {
|
||||
a.formIntersection(identity(b))
|
||||
}
|
||||
@@ -414,13 +414,13 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> formSymmetricDifference with Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> formSymmetricDifference with Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
timer.measure {
|
||||
a.formSymmetricDifference(identity(b))
|
||||
}
|
||||
@@ -431,13 +431,13 @@ extension Benchmark {
|
||||
|
||||
for (percentage, start) in overlaps {
|
||||
self.add(
|
||||
title: "ShareableSet<Int> subtract Array (\(percentage) overlap)",
|
||||
title: "TreeSet<Int> subtract Array (\(percentage) overlap)",
|
||||
input: [Int].self
|
||||
) { input in
|
||||
let start = start(input.count)
|
||||
let b = Array(start ..< start + input.count)
|
||||
return { timer in
|
||||
var a = ShareableSet(input)
|
||||
var a = TreeSet(input)
|
||||
timer.measure {
|
||||
a.subtract(identity(b))
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ benchmark.registerCustomGenerators()
|
||||
benchmark.addArrayBenchmarks()
|
||||
benchmark.addSetBenchmarks()
|
||||
benchmark.addDictionaryBenchmarks()
|
||||
benchmark.addShareableDictionaryBenchmarks()
|
||||
benchmark.addTreeDictionaryBenchmarks()
|
||||
benchmark.addDequeBenchmarks()
|
||||
benchmark.addOrderedSetBenchmarks()
|
||||
benchmark.addOrderedDictionaryBenchmarks()
|
||||
benchmark.addHeapBenchmarks()
|
||||
benchmark.addBitSetBenchmarks()
|
||||
benchmark.addShareableSetBenchmarks()
|
||||
benchmark.addTreeSetBenchmarks()
|
||||
benchmark.addCppBenchmarks()
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
|
||||
benchmark.addFoundationBenchmarks()
|
||||
|
||||
@@ -30,11 +30,11 @@ struct MemoryBenchmarks: ParsableCommand {
|
||||
var i = 0
|
||||
|
||||
var d: Dictionary<String, String> = [:]
|
||||
var pd: ShareableDictionary<String, String> = [:]
|
||||
var pd: TreeDictionary<String, String> = [:]
|
||||
|
||||
print("""
|
||||
Size,"Dictionary<String, String>",\
|
||||
"ShareableDictionary<String, String>",\
|
||||
"TreeDictionary<String, String>",\
|
||||
"average node size",\
|
||||
"average item depth"
|
||||
""")
|
||||
@@ -67,9 +67,9 @@ struct MemoryBenchmarks: ParsableCommand {
|
||||
complain("""
|
||||
Averages:
|
||||
Dictionary: \(sumd / Double(sizes.count))
|
||||
ShareableDictionary: \(sump / Double(sizes.count))
|
||||
TreeDictionary: \(sump / Double(sizes.count))
|
||||
|
||||
ShareableDictionary at 1M items:
|
||||
TreeDictionary at 1M items:
|
||||
average node size: \(pstats.averageNodeSize)
|
||||
average item depth: \(pstats.averageItemDepth)
|
||||
average lookup chain length: \(pstats.averageLookupChainLength)
|
||||
|
||||
+6
-6
@@ -52,7 +52,7 @@ let package = Package(
|
||||
.library(name: "DequeModule", targets: ["DequeModule"]),
|
||||
.library(name: "HeapModule", targets: ["HeapModule"]),
|
||||
.library(name: "OrderedCollections", targets: ["OrderedCollections"]),
|
||||
.library(name: "ShareableHashedCollections", targets: ["ShareableHashedCollections"]),
|
||||
.library(name: "HashTreeCollections", targets: ["HashTreeCollections"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
@@ -62,7 +62,7 @@ let package = Package(
|
||||
"DequeModule",
|
||||
"HeapModule",
|
||||
"OrderedCollections",
|
||||
"ShareableHashedCollections",
|
||||
"HashTreeCollections",
|
||||
],
|
||||
exclude: ["CMakeLists.txt"],
|
||||
swiftSettings: settings),
|
||||
@@ -134,15 +134,15 @@ let package = Package(
|
||||
dependencies: ["OrderedCollections", "_CollectionsTestSupport"],
|
||||
swiftSettings: settings),
|
||||
|
||||
// ShareableSet<Element>, ShareableDictionary<Key, Value>
|
||||
// TreeSet<Element>, TreeDictionary<Key, Value>
|
||||
.target(
|
||||
name: "ShareableHashedCollections",
|
||||
name: "HashTreeCollections",
|
||||
dependencies: ["_CollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"],
|
||||
swiftSettings: settings),
|
||||
.testTarget(
|
||||
name: "ShareableHashedCollectionsTests",
|
||||
dependencies: ["ShareableHashedCollections", "_CollectionsTestSupport"],
|
||||
name: "HashTreeCollectionsTests",
|
||||
dependencies: ["HashTreeCollections", "_CollectionsTestSupport"],
|
||||
swiftSettings: settings),
|
||||
]
|
||||
)
|
||||
@@ -20,7 +20,7 @@ The package currently provides the following implementations:
|
||||
|
||||
- [`OrderedDictionary<Key, Value>`][OrderedDictionary], an ordered variant of the standard `Dictionary`, providing similar benefits.
|
||||
|
||||
- [`ShareableSet`][ShareableSet] and [`ShareableDictionary`][ShareableDictionary], persistent hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). These work similar to the standard `Set` and `Dictionary`, but they excel at use cases that mutate shared copies, offering dramatic memory savings and radical time improvements.
|
||||
- [`TreeSet`][TreeSet] and [`TreeDictionary`][TreeDictionary], persistent hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). These work similar to the standard `Set` and `Dictionary`, but they excel at use cases that mutate shared copies, offering dramatic memory savings and radical time improvements.
|
||||
|
||||
[BitSet]: Documentation/BitSet.md
|
||||
[BitArray]: Documentation/BitArray.md
|
||||
@@ -28,8 +28,8 @@ The package currently provides the following implementations:
|
||||
[Heap]: Documentation/Heap.md
|
||||
[OrderedSet]: Documentation/OrderedSet.md
|
||||
[OrderedDictionary]: Documentation/OrderedDictionary.md
|
||||
[ShareableSet]: Documentation/ShareableSet.md
|
||||
[ShareableDictionary]: Documentation/ShareableDictionary.md
|
||||
[TreeSet]: Documentation/TreeSet.md
|
||||
[TreeDictionary]: Documentation/TreeDictionary.md
|
||||
|
||||
The following data structures are currently being worked on but they aren't ready for inclusion in a tagged release:
|
||||
|
||||
@@ -55,7 +55,7 @@ The Swift Collections package is source stable. The version numbers follow [Sema
|
||||
|
||||
[semver]: https://semver.org
|
||||
|
||||
The public API of version 1.1 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `ShareableHashedCollections` modules.
|
||||
The public API of version 1.1 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `HashTreeCollections` modules.
|
||||
|
||||
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
|
||||
If you have a use case that requires using underscored APIs, please [submit a Feature Request][enhancement] describing it! We'd like the public interface to be as useful as possible -- although preferably without compromising safety or limiting future evolution.
|
||||
|
||||
@@ -12,5 +12,5 @@ add_subdirectory(Collections)
|
||||
add_subdirectory(DequeModule)
|
||||
add_subdirectory(HeapModule)
|
||||
add_subdirectory(OrderedCollections)
|
||||
add_subdirectory(ShareableHashedCollections)
|
||||
add_subdirectory(HashTreeCollections)
|
||||
add_subdirectory(_CollectionsUtilities)
|
||||
@@ -14,7 +14,7 @@ target_link_libraries(Collections PRIVATE
|
||||
DequeModule
|
||||
HeapModule
|
||||
OrderedCollections
|
||||
ShareableHashedCollections
|
||||
HashTreeCollections
|
||||
)
|
||||
set_target_properties(Collections PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
- ``OrderedSet``
|
||||
- ``OrderedDictionary``
|
||||
|
||||
### Persistent Collections
|
||||
### Persistent Hashed Collections
|
||||
|
||||
- ``ShareableSet``
|
||||
- ``ShareableDictionary``
|
||||
- ``TreeSet``
|
||||
- ``TreeDictionary``
|
||||
+22
-22
@@ -1,4 +1,4 @@
|
||||
# ``Collections/ShareableDictionary``
|
||||
# ``Collections/TreeDictionary``
|
||||
|
||||
<!-- DO NOT EDIT THIS FILE; IT'S AUTOMATICALLY GENERATED -->
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
### Collection Views
|
||||
|
||||
`ShareableDictionary` provides the customary dictionary views, `keys` and
|
||||
`TreeDictionary` provides the customary dictionary views, `keys` and
|
||||
`values`. These are collection types that are projections of the dictionary
|
||||
itself, with elements that match only the keys or values of the dictionary,
|
||||
respectively. The `Keys` view is notable in that it provides operations for
|
||||
subtracting and intersecting the keys of two dictionaries, allowing for easy
|
||||
detection of inserted and removed items between two snapshots of the same
|
||||
dictionary. Because `ShareableDictionary` needs to invalidate indices on every
|
||||
dictionary. Because `TreeDictionary` needs to invalidate indices on every
|
||||
mutation, its `Values` view is not a `MutableCollection`.
|
||||
|
||||
- ``Keys-swift.struct``
|
||||
@@ -28,46 +28,46 @@ mutation, its `Values` view is not a `MutableCollection`.
|
||||
### Creating a Dictionary
|
||||
|
||||
- ``init()``
|
||||
- ``init(_:)-68s80``
|
||||
- ``init(_:)-2ngkk``
|
||||
- ``init(uniqueKeysWithValues:)-688fi``
|
||||
- ``init(uniqueKeysWithValues:)-3h2xe``
|
||||
- ``init(_:uniquingKeysWith:)-6t92n``
|
||||
- ``init(_:uniquingKeysWith:)-9opgv``
|
||||
- ``init(grouping:by:)-6ddmm``
|
||||
- ``init(grouping:by:)-9rc24``
|
||||
- ``init(_:)-111p1``
|
||||
- ``init(_:)-9atjh``
|
||||
- ``init(uniqueKeysWithValues:)-2hosl``
|
||||
- ``init(uniqueKeysWithValues:)-92276``
|
||||
- ``init(_:uniquingKeysWith:)-6nofo``
|
||||
- ``init(_:uniquingKeysWith:)-99403``
|
||||
- ``init(grouping:by:)-a4ma``
|
||||
- ``init(grouping:by:)-4he86``
|
||||
- ``init(keys:valueGenerator:)``
|
||||
|
||||
|
||||
### Inspecting a Dictionary
|
||||
|
||||
- ``isEmpty-25p4``
|
||||
- ``count-8s588``
|
||||
- ``isEmpty-6icj0``
|
||||
- ``count-ibl8``
|
||||
|
||||
### Accessing Keys and Values
|
||||
|
||||
- ``subscript(_:)-6jbab``
|
||||
- ``subscript(_:)-8gx3j``
|
||||
- ``subscript(_:default:)``
|
||||
- ``index(forKey:)``
|
||||
|
||||
### Adding or Updating Keys and Values
|
||||
|
||||
Beyond the standard `updateValue(_:forKey:)` method, `ShareableDictionary` also
|
||||
Beyond the standard `updateValue(_:forKey:)` method, `TreeDictionary` also
|
||||
provides additional `updateValue` variants that take closure arguments. These
|
||||
provide a more straightforward way to perform in-place mutations on dictionary
|
||||
values (compared to mutating values through the corresponding subscript
|
||||
operation.) `ShareableDictionary` also provides the standard `merge` and
|
||||
operation.) `TreeDictionary` also provides the standard `merge` and
|
||||
`merging` operations for combining dictionary values.
|
||||
|
||||
- ``updateValue(_:forKey:)``
|
||||
- ``updateValue(forKey:with:)``
|
||||
- ``updateValue(forKey:default:with:)``
|
||||
- ``merge(_:uniquingKeysWith:)-218dc``
|
||||
- ``merge(_:uniquingKeysWith:)-8gdr2``
|
||||
- ``merge(_:uniquingKeysWith:)-6j72k``
|
||||
- ``merging(_:uniquingKeysWith:)-88sah``
|
||||
- ``merging(_:uniquingKeysWith:)-2qknu``
|
||||
- ``merging(_:uniquingKeysWith:)-3hao7``
|
||||
- ``merge(_:uniquingKeysWith:)-59cm5``
|
||||
- ``merge(_:uniquingKeysWith:)-38axt``
|
||||
- ``merge(_:uniquingKeysWith:)-3s4cw``
|
||||
- ``merging(_:uniquingKeysWith:)-3khxe``
|
||||
- ``merging(_:uniquingKeysWith:)-1k63w``
|
||||
- ``merging(_:uniquingKeysWith:)-87wp7``
|
||||
|
||||
### Removing Keys and Values
|
||||
|
||||
+52
-52
@@ -1,11 +1,11 @@
|
||||
# ``Collections/ShareableSet``
|
||||
# ``Collections/TreeSet``
|
||||
|
||||
<!-- DO NOT EDIT THIS FILE; IT'S AUTOMATICALLY GENERATED -->
|
||||
|
||||
|
||||
### Implementation Details
|
||||
|
||||
`ShareableSet` and `ShareableDictionary` are based on a Swift adaptation
|
||||
`TreeSet` and `TreeDictionary` are based on a Swift adaptation
|
||||
of the *Compressed Hash-Array Mapped Prefix Tree* (CHAMP) data structure.
|
||||
|
||||
- Michael J Steindorfer and Jurgen J Vinju. Optimizing Hash-Array Mapped
|
||||
@@ -18,7 +18,7 @@ In this setup, the members of such a collection are organized into a tree
|
||||
data structure based on their hash values. For example, assuming 16 bit hash
|
||||
values sliced into 4-bit chunks, each node in the prefix tree would have
|
||||
sixteen slots (one for each digit), each of which may contain a member, a
|
||||
child node reference, or it may be empty. A `ShareableSet` containing the
|
||||
child node reference, or it may be empty. A `TreeSet` containing the
|
||||
three items `Maximo`, `Julia` and `Don Pablo` (with hash values of `0x2B65`,
|
||||
`0xA69F` and `0xADA1`, respectively) may be organized into a prefix tree of
|
||||
two nodes:
|
||||
@@ -65,7 +65,7 @@ share the same hash. Looking up a member in one of these nodes requires a
|
||||
linear search, so it is crucial that such collisions do not happen often.
|
||||
|
||||
As long as `Element` properly implements `Hashable`, lookup operations in a
|
||||
`ShareableSet` are expected to be able to decide whether the set contains a
|
||||
`TreeSet` are expected to be able to decide whether the set contains a
|
||||
particular item by looking at no more than a constant number of items on
|
||||
average -- typically they will need to compare against just one member.
|
||||
|
||||
@@ -74,9 +74,9 @@ average -- typically they will need to compare against just one member.
|
||||
### Creating a Set
|
||||
|
||||
- ``init()``
|
||||
- ``init(_:)-1qufh``
|
||||
- ``init(_:)-49yo2``
|
||||
- ``init(_:)-56pm1``
|
||||
- ``init(_:)-2uun3``
|
||||
- ``init(_:)-714nu``
|
||||
- ``init(_:)-6lt4a``
|
||||
|
||||
### Finding Elements
|
||||
|
||||
@@ -102,73 +102,73 @@ average -- typically they will need to compare against just one member.
|
||||
All the standard combining operations (intersection, union, subtraction and
|
||||
symmetric difference) are supported, in both non-mutating and mutating forms.
|
||||
`SetAlgebra` only requires the ability to combine one set instance with another,
|
||||
but `ShareableSet` follows the tradition established by `Set` in providing
|
||||
but `TreeSet` follows the tradition established by `Set` in providing
|
||||
additional overloads to each operation that allow combining a set with
|
||||
additional types, including arbitrary sequences.
|
||||
|
||||
- ``intersection(_:)-8few3``
|
||||
- ``intersection(_:)-61b7q``
|
||||
- ``intersection(_:)-2ncm4``
|
||||
- ``intersection(_:)-8ltpr``
|
||||
- ``intersection(_:)-9kwc0``
|
||||
- ``intersection(_:)-4u7ew``
|
||||
|
||||
- ``union(_:)-3e3nw``
|
||||
- ``union(_:)-8twku``
|
||||
- ``union(_:)-9f4y4``
|
||||
- ``union(_:)-89jj2``
|
||||
- ``union(_:)-9yvze``
|
||||
- ``union(_:)-7p0m2``
|
||||
|
||||
- ``subtracting(_:)-6v3hx``
|
||||
- ``subtracting(_:)-zt78``
|
||||
- ``subtracting(_:)-9n0oc``
|
||||
- ``subtracting(_:)-cnsi``
|
||||
- ``subtracting(_:)-3yfac``
|
||||
- ``subtracting(_:)-90wrb``
|
||||
|
||||
- ``symmetricDifference(_:)-7o2iv``
|
||||
- ``symmetricDifference(_:)-3jhi3``
|
||||
- ``symmetricDifference(_:)-2hxgg``
|
||||
- ``symmetricDifference(_:)-5bz4f``
|
||||
- ``symmetricDifference(_:)-6p8n5``
|
||||
- ``symmetricDifference(_:)-3qk9w``
|
||||
|
||||
- ``formIntersection(_:)-48ki1``
|
||||
- ``formIntersection(_:)-8qfxe``
|
||||
- ``formIntersection(_:)-nne6``
|
||||
- ``formIntersection(_:)-1zcar``
|
||||
- ``formIntersection(_:)-4xkf0``
|
||||
- ``formIntersection(_:)-6jb2z``
|
||||
|
||||
- ``formUnion(_:)-1qwuq``
|
||||
- ``formUnion(_:)-2raoj``
|
||||
- ``formUnion(_:)-ew7g``
|
||||
- ``formUnion(_:)-420zl``
|
||||
- ``formUnion(_:)-8zu6q``
|
||||
- ``formUnion(_:)-423id``
|
||||
|
||||
- ``subtract(_:)-24txa``
|
||||
- ``subtract(_:)-69g3``
|
||||
- ``subtract(_:)-5l8bb``
|
||||
- ``subtract(_:)-49o9``
|
||||
- ``subtract(_:)-3ebkc``
|
||||
- ``subtract(_:)-87rhs``
|
||||
|
||||
- ``formSymmetricDifference(_:)-6zqa1``
|
||||
- ``formSymmetricDifference(_:)-mv0q``
|
||||
- ``formSymmetricDifference(_:)-2qzlu``
|
||||
- ``formSymmetricDifference(_:)-94f6x``
|
||||
- ``formSymmetricDifference(_:)-4x7vw``
|
||||
- ``formSymmetricDifference(_:)-6ypuy``
|
||||
|
||||
### Comparing Sets
|
||||
|
||||
`ShareableSet` supports all standard set comparisons (subset tests, superset
|
||||
`TreeSet` supports all standard set comparisons (subset tests, superset
|
||||
tests, disjunctness test), including the customary overloads established by
|
||||
`Set`. As an additional extension, the `isEqualSet` family of member functions
|
||||
generalize the standard `==` operation to support checking whether a
|
||||
`ShareableSet` consists of exactly the same members as an arbitrary sequence.
|
||||
`TreeSet` consists of exactly the same members as an arbitrary sequence.
|
||||
Like `==`, the `isEqualSet` functions ignore element ordering and duplicates (if
|
||||
any).
|
||||
|
||||
- ``==(_:_:)``
|
||||
- ``isEqualSet(to:)-5lpwv``
|
||||
- ``isEqualSet(to:)-6ont2``
|
||||
- ``isEqualSet(to:)-58q8h``
|
||||
- ``isEqualSet(to:)-4bc1i``
|
||||
- ``isEqualSet(to:)-7x4yi``
|
||||
- ``isEqualSet(to:)-44fkf``
|
||||
|
||||
- ``isSubset(of:)-2itju``
|
||||
- ``isSubset(of:)-2nice``
|
||||
- ``isSubset(of:)-8qszd``
|
||||
- ``isSubset(of:)-2ktpu``
|
||||
- ``isSubset(of:)-5oufi``
|
||||
- ``isSubset(of:)-9tq5c``
|
||||
|
||||
- ``isSuperset(of:)-9mp0j``
|
||||
- ``isSuperset(of:)-3pm0f``
|
||||
- ``isSuperset(of:)-63haf``
|
||||
- ``isSuperset(of:)-3zd41``
|
||||
- ``isSuperset(of:)-6xa75``
|
||||
- ``isSuperset(of:)-6vw4t``
|
||||
|
||||
- ``isStrictSubset(of:)-1cdr``
|
||||
- ``isStrictSubset(of:)-3xlgn``
|
||||
- ``isStrictSubset(of:)-8oyb4``
|
||||
- ``isStrictSubset(of:)-6xuil``
|
||||
- ``isStrictSubset(of:)-22f80``
|
||||
- ``isStrictSubset(of:)-5f78e``
|
||||
|
||||
- ``isStrictSuperset(of:)-7qgvz``
|
||||
- ``isStrictSuperset(of:)-3fdsl``
|
||||
- ``isStrictSuperset(of:)-2ujyn``
|
||||
- ``isStrictSuperset(of:)-4ryjr``
|
||||
- ``isStrictSuperset(of:)-3ephc``
|
||||
- ``isStrictSuperset(of:)-9ftlc``
|
||||
|
||||
- ``isDisjoint(with:)-eq16``
|
||||
- ``isDisjoint(with:)-8bgbj``
|
||||
- ``isDisjoint(with:)-5b64c``
|
||||
- ``isDisjoint(with:)-4a9xa``
|
||||
- ``isDisjoint(with:)-12a64``
|
||||
- ``isDisjoint(with:)-5lvdr``
|
||||
@@ -13,4 +13,4 @@
|
||||
@_exported import DequeModule
|
||||
@_exported import HeapModule
|
||||
@_exported import OrderedCollections
|
||||
@_exported import ShareableHashedCollections
|
||||
@_exported import HashTreeCollections
|
||||
@@ -0,0 +1,103 @@
|
||||
#[[
|
||||
This source file is part of the Swift Collections Open Source Project
|
||||
|
||||
Copyright (c) 2022 Apple Inc. and the Swift project authors
|
||||
Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
|
||||
See https://swift.org/LICENSE.txt for license information
|
||||
#]]
|
||||
|
||||
add_library(HashTreeCollections
|
||||
"Node/_AncestorSlots.swift"
|
||||
"Node/_Bitmap.swift"
|
||||
"Node/_Bucket.swift"
|
||||
"Node/_Hash.swift"
|
||||
"Node/_HashTreeIterator.swift"
|
||||
"Node/_HashTreeStatistics.swift"
|
||||
"Node/_Level.swift"
|
||||
"Node/_Node+Builder.swift"
|
||||
"Node/_Node+Debugging.swift"
|
||||
"Node/_Node+Initializers.swift"
|
||||
"Node/_Node+Invariants.swift"
|
||||
"Node/_Node+Lookups.swift"
|
||||
"Node/_Node+Primitive Insertions.swift"
|
||||
"Node/_Node+Primitive Removals.swift"
|
||||
"Node/_Node+Primitive Replacement.swift"
|
||||
"Node/_Node+Storage.swift"
|
||||
"Node/_Node+Structural compactMapValues.swift"
|
||||
"Node/_Node+Structural filter.swift"
|
||||
"Node/_Node+Structural intersection.swift"
|
||||
"Node/_Node+Structural isDisjoint.swift"
|
||||
"Node/_Node+Structural isEqualSet.swift"
|
||||
"Node/_Node+Structural isSubset.swift"
|
||||
"Node/_Node+Structural mapValues.swift"
|
||||
"Node/_Node+Structural merge.swift"
|
||||
"Node/_Node+Structural subtracting.swift"
|
||||
"Node/_Node+Structural symmetricDifference.swift"
|
||||
"Node/_Node+Structural union.swift"
|
||||
"Node/_Node+Subtree Insertions.swift"
|
||||
"Node/_Node+Subtree Modify.swift"
|
||||
"Node/_Node+Subtree Removals.swift"
|
||||
"Node/_Node+UnsafeHandle.swift"
|
||||
"Node/_Node.swift"
|
||||
"Node/_RawNode+UnsafeHandle.swift"
|
||||
"Node/_RawNode.swift"
|
||||
"Node/_Slot.swift"
|
||||
"Node/_Stack.swift"
|
||||
"Node/_StorageHeader.swift"
|
||||
"Node/_UnmanagedNode.swift"
|
||||
"Node/_UnsafePath.swift"
|
||||
"TreeDictionary/TreeDictionary+Codable.swift"
|
||||
"TreeDictionary/TreeDictionary+Collection.swift"
|
||||
"TreeDictionary/TreeDictionary+CustomReflectable.swift"
|
||||
"TreeDictionary/TreeDictionary+Debugging.swift"
|
||||
"TreeDictionary/TreeDictionary+Descriptions.swift"
|
||||
"TreeDictionary/TreeDictionary+Equatable.swift"
|
||||
"TreeDictionary/TreeDictionary+ExpressibleByDictionaryLiteral.swift"
|
||||
"TreeDictionary/TreeDictionary+Filter.swift"
|
||||
"TreeDictionary/TreeDictionary+Hashable.swift"
|
||||
"TreeDictionary/TreeDictionary+Initializers.swift"
|
||||
"TreeDictionary/TreeDictionary+Keys.swift"
|
||||
"TreeDictionary/TreeDictionary+MapValues.swift"
|
||||
"TreeDictionary/TreeDictionary+Merge.swift"
|
||||
"TreeDictionary/TreeDictionary+Sendable.swift"
|
||||
"TreeDictionary/TreeDictionary+Sequence.swift"
|
||||
"TreeDictionary/TreeDictionary+Values.swift"
|
||||
"TreeDictionary/TreeDictionary.swift"
|
||||
"TreeSet/TreeSet+Codable.swift"
|
||||
"TreeSet/TreeSet+Collection.swift"
|
||||
"TreeSet/TreeSet+CustomReflectable.swift"
|
||||
"TreeSet/TreeSet+Debugging.swift"
|
||||
"TreeSet/TreeSet+Descriptions.swift"
|
||||
"TreeSet/TreeSet+Equatable.swift"
|
||||
"TreeSet/TreeSet+ExpressibleByArrayLiteral.swift"
|
||||
"TreeSet/TreeSet+Extras.swift"
|
||||
"TreeSet/TreeSet+Filter.swift"
|
||||
"TreeSet/TreeSet+Hashable.swift"
|
||||
"TreeSet/TreeSet+Sendable.swift"
|
||||
"TreeSet/TreeSet+Sequence.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra Initializers.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra basics.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra formIntersection.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra formSymmetricDifference.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra formUnion.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra intersection.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isDisjoint.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isEqualSet.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isStrictSubset.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isStrictSuperset.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isSubset.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra isSuperset.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra subtract.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra subtracting.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra symmetricDifference.swift"
|
||||
"TreeSet/TreeSet+SetAlgebra union.swift"
|
||||
"TreeSet/TreeSet.swift"
|
||||
)
|
||||
target_link_libraries(HashTreeCollections PRIVATE
|
||||
_CollectionsUtilities)
|
||||
set_target_properties(HashTreeCollections PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
|
||||
|
||||
_install_target(HashTreeCollections)
|
||||
set_property(GLOBAL APPEND PROPERTY SWIFT_COLLECTIONS_EXPORTS HashTreeCollections)
|
||||
+22
-22
@@ -1,4 +1,4 @@
|
||||
# ``ShareableHashedCollections/ShareableDictionary``
|
||||
# ``HashTreeCollections/TreeDictionary``
|
||||
|
||||
<!-- Summary -->
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
### Collection Views
|
||||
|
||||
`ShareableDictionary` provides the customary dictionary views, `keys` and
|
||||
`TreeDictionary` provides the customary dictionary views, `keys` and
|
||||
`values`. These are collection types that are projections of the dictionary
|
||||
itself, with elements that match only the keys or values of the dictionary,
|
||||
respectively. The `Keys` view is notable in that it provides operations for
|
||||
subtracting and intersecting the keys of two dictionaries, allowing for easy
|
||||
detection of inserted and removed items between two snapshots of the same
|
||||
dictionary. Because `ShareableDictionary` needs to invalidate indices on every
|
||||
dictionary. Because `TreeDictionary` needs to invalidate indices on every
|
||||
mutation, its `Values` view is not a `MutableCollection`.
|
||||
|
||||
- ``Keys-swift.struct``
|
||||
@@ -25,46 +25,46 @@ mutation, its `Values` view is not a `MutableCollection`.
|
||||
### Creating a Dictionary
|
||||
|
||||
- ``init()``
|
||||
- ``init(_:)-68s80``
|
||||
- ``init(_:)-2ngkk``
|
||||
- ``init(uniqueKeysWithValues:)-688fi``
|
||||
- ``init(uniqueKeysWithValues:)-3h2xe``
|
||||
- ``init(_:uniquingKeysWith:)-6t92n``
|
||||
- ``init(_:uniquingKeysWith:)-9opgv``
|
||||
- ``init(grouping:by:)-6ddmm``
|
||||
- ``init(grouping:by:)-9rc24``
|
||||
- ``init(_:)-111p1``
|
||||
- ``init(_:)-9atjh``
|
||||
- ``init(uniqueKeysWithValues:)-2hosl``
|
||||
- ``init(uniqueKeysWithValues:)-92276``
|
||||
- ``init(_:uniquingKeysWith:)-6nofo``
|
||||
- ``init(_:uniquingKeysWith:)-99403``
|
||||
- ``init(grouping:by:)-a4ma``
|
||||
- ``init(grouping:by:)-4he86``
|
||||
- ``init(keys:valueGenerator:)``
|
||||
|
||||
|
||||
### Inspecting a Dictionary
|
||||
|
||||
- ``isEmpty-25p4``
|
||||
- ``count-8s588``
|
||||
- ``isEmpty-6icj0``
|
||||
- ``count-ibl8``
|
||||
|
||||
### Accessing Keys and Values
|
||||
|
||||
- ``subscript(_:)-6jbab``
|
||||
- ``subscript(_:)-8gx3j``
|
||||
- ``subscript(_:default:)``
|
||||
- ``index(forKey:)``
|
||||
|
||||
### Adding or Updating Keys and Values
|
||||
|
||||
Beyond the standard `updateValue(_:forKey:)` method, `ShareableDictionary` also
|
||||
Beyond the standard `updateValue(_:forKey:)` method, `TreeDictionary` also
|
||||
provides additional `updateValue` variants that take closure arguments. These
|
||||
provide a more straightforward way to perform in-place mutations on dictionary
|
||||
values (compared to mutating values through the corresponding subscript
|
||||
operation.) `ShareableDictionary` also provides the standard `merge` and
|
||||
operation.) `TreeDictionary` also provides the standard `merge` and
|
||||
`merging` operations for combining dictionary values.
|
||||
|
||||
- ``updateValue(_:forKey:)``
|
||||
- ``updateValue(forKey:with:)``
|
||||
- ``updateValue(forKey:default:with:)``
|
||||
- ``merge(_:uniquingKeysWith:)-218dc``
|
||||
- ``merge(_:uniquingKeysWith:)-8gdr2``
|
||||
- ``merge(_:uniquingKeysWith:)-6j72k``
|
||||
- ``merging(_:uniquingKeysWith:)-88sah``
|
||||
- ``merging(_:uniquingKeysWith:)-2qknu``
|
||||
- ``merging(_:uniquingKeysWith:)-3hao7``
|
||||
- ``merge(_:uniquingKeysWith:)-59cm5``
|
||||
- ``merge(_:uniquingKeysWith:)-38axt``
|
||||
- ``merge(_:uniquingKeysWith:)-3s4cw``
|
||||
- ``merging(_:uniquingKeysWith:)-3khxe``
|
||||
- ``merging(_:uniquingKeysWith:)-1k63w``
|
||||
- ``merging(_:uniquingKeysWith:)-87wp7``
|
||||
|
||||
### Removing Keys and Values
|
||||
|
||||
+52
-52
@@ -1,8 +1,8 @@
|
||||
# ``ShareableHashedCollections/ShareableSet``
|
||||
# ``HashTreeCollections/TreeSet``
|
||||
|
||||
### Implementation Details
|
||||
|
||||
`ShareableSet` and `ShareableDictionary` are based on a Swift adaptation
|
||||
`TreeSet` and `TreeDictionary` are based on a Swift adaptation
|
||||
of the *Compressed Hash-Array Mapped Prefix Tree* (CHAMP) data structure.
|
||||
|
||||
- Michael J Steindorfer and Jurgen J Vinju. Optimizing Hash-Array Mapped
|
||||
@@ -15,7 +15,7 @@ In this setup, the members of such a collection are organized into a tree
|
||||
data structure based on their hash values. For example, assuming 16 bit hash
|
||||
values sliced into 4-bit chunks, each node in the prefix tree would have
|
||||
sixteen slots (one for each digit), each of which may contain a member, a
|
||||
child node reference, or it may be empty. A `ShareableSet` containing the
|
||||
child node reference, or it may be empty. A `TreeSet` containing the
|
||||
three items `Maximo`, `Julia` and `Don Pablo` (with hash values of `0x2B65`,
|
||||
`0xA69F` and `0xADA1`, respectively) may be organized into a prefix tree of
|
||||
two nodes:
|
||||
@@ -62,7 +62,7 @@ share the same hash. Looking up a member in one of these nodes requires a
|
||||
linear search, so it is crucial that such collisions do not happen often.
|
||||
|
||||
As long as `Element` properly implements `Hashable`, lookup operations in a
|
||||
`ShareableSet` are expected to be able to decide whether the set contains a
|
||||
`TreeSet` are expected to be able to decide whether the set contains a
|
||||
particular item by looking at no more than a constant number of items on
|
||||
average -- typically they will need to compare against just one member.
|
||||
|
||||
@@ -71,9 +71,9 @@ average -- typically they will need to compare against just one member.
|
||||
### Creating a Set
|
||||
|
||||
- ``init()``
|
||||
- ``init(_:)-1qufh``
|
||||
- ``init(_:)-49yo2``
|
||||
- ``init(_:)-56pm1``
|
||||
- ``init(_:)-2uun3``
|
||||
- ``init(_:)-714nu``
|
||||
- ``init(_:)-6lt4a``
|
||||
|
||||
### Finding Elements
|
||||
|
||||
@@ -99,73 +99,73 @@ average -- typically they will need to compare against just one member.
|
||||
All the standard combining operations (intersection, union, subtraction and
|
||||
symmetric difference) are supported, in both non-mutating and mutating forms.
|
||||
`SetAlgebra` only requires the ability to combine one set instance with another,
|
||||
but `ShareableSet` follows the tradition established by `Set` in providing
|
||||
but `TreeSet` follows the tradition established by `Set` in providing
|
||||
additional overloads to each operation that allow combining a set with
|
||||
additional types, including arbitrary sequences.
|
||||
|
||||
- ``intersection(_:)-8few3``
|
||||
- ``intersection(_:)-61b7q``
|
||||
- ``intersection(_:)-2ncm4``
|
||||
- ``intersection(_:)-8ltpr``
|
||||
- ``intersection(_:)-9kwc0``
|
||||
- ``intersection(_:)-4u7ew``
|
||||
|
||||
- ``union(_:)-3e3nw``
|
||||
- ``union(_:)-8twku``
|
||||
- ``union(_:)-9f4y4``
|
||||
- ``union(_:)-89jj2``
|
||||
- ``union(_:)-9yvze``
|
||||
- ``union(_:)-7p0m2``
|
||||
|
||||
- ``subtracting(_:)-6v3hx``
|
||||
- ``subtracting(_:)-zt78``
|
||||
- ``subtracting(_:)-9n0oc``
|
||||
- ``subtracting(_:)-cnsi``
|
||||
- ``subtracting(_:)-3yfac``
|
||||
- ``subtracting(_:)-90wrb``
|
||||
|
||||
- ``symmetricDifference(_:)-7o2iv``
|
||||
- ``symmetricDifference(_:)-3jhi3``
|
||||
- ``symmetricDifference(_:)-2hxgg``
|
||||
- ``symmetricDifference(_:)-5bz4f``
|
||||
- ``symmetricDifference(_:)-6p8n5``
|
||||
- ``symmetricDifference(_:)-3qk9w``
|
||||
|
||||
- ``formIntersection(_:)-48ki1``
|
||||
- ``formIntersection(_:)-8qfxe``
|
||||
- ``formIntersection(_:)-nne6``
|
||||
- ``formIntersection(_:)-1zcar``
|
||||
- ``formIntersection(_:)-4xkf0``
|
||||
- ``formIntersection(_:)-6jb2z``
|
||||
|
||||
- ``formUnion(_:)-1qwuq``
|
||||
- ``formUnion(_:)-2raoj``
|
||||
- ``formUnion(_:)-ew7g``
|
||||
- ``formUnion(_:)-420zl``
|
||||
- ``formUnion(_:)-8zu6q``
|
||||
- ``formUnion(_:)-423id``
|
||||
|
||||
- ``subtract(_:)-24txa``
|
||||
- ``subtract(_:)-69g3``
|
||||
- ``subtract(_:)-5l8bb``
|
||||
- ``subtract(_:)-49o9``
|
||||
- ``subtract(_:)-3ebkc``
|
||||
- ``subtract(_:)-87rhs``
|
||||
|
||||
- ``formSymmetricDifference(_:)-6zqa1``
|
||||
- ``formSymmetricDifference(_:)-mv0q``
|
||||
- ``formSymmetricDifference(_:)-2qzlu``
|
||||
- ``formSymmetricDifference(_:)-94f6x``
|
||||
- ``formSymmetricDifference(_:)-4x7vw``
|
||||
- ``formSymmetricDifference(_:)-6ypuy``
|
||||
|
||||
### Comparing Sets
|
||||
|
||||
`ShareableSet` supports all standard set comparisons (subset tests, superset
|
||||
`TreeSet` supports all standard set comparisons (subset tests, superset
|
||||
tests, disjunctness test), including the customary overloads established by
|
||||
`Set`. As an additional extension, the `isEqualSet` family of member functions
|
||||
generalize the standard `==` operation to support checking whether a
|
||||
`ShareableSet` consists of exactly the same members as an arbitrary sequence.
|
||||
`TreeSet` consists of exactly the same members as an arbitrary sequence.
|
||||
Like `==`, the `isEqualSet` functions ignore element ordering and duplicates (if
|
||||
any).
|
||||
|
||||
- ``==(_:_:)``
|
||||
- ``isEqualSet(to:)-5lpwv``
|
||||
- ``isEqualSet(to:)-6ont2``
|
||||
- ``isEqualSet(to:)-58q8h``
|
||||
- ``isEqualSet(to:)-4bc1i``
|
||||
- ``isEqualSet(to:)-7x4yi``
|
||||
- ``isEqualSet(to:)-44fkf``
|
||||
|
||||
- ``isSubset(of:)-2itju``
|
||||
- ``isSubset(of:)-2nice``
|
||||
- ``isSubset(of:)-8qszd``
|
||||
- ``isSubset(of:)-2ktpu``
|
||||
- ``isSubset(of:)-5oufi``
|
||||
- ``isSubset(of:)-9tq5c``
|
||||
|
||||
- ``isSuperset(of:)-9mp0j``
|
||||
- ``isSuperset(of:)-3pm0f``
|
||||
- ``isSuperset(of:)-63haf``
|
||||
- ``isSuperset(of:)-3zd41``
|
||||
- ``isSuperset(of:)-6xa75``
|
||||
- ``isSuperset(of:)-6vw4t``
|
||||
|
||||
- ``isStrictSubset(of:)-1cdr``
|
||||
- ``isStrictSubset(of:)-3xlgn``
|
||||
- ``isStrictSubset(of:)-8oyb4``
|
||||
- ``isStrictSubset(of:)-6xuil``
|
||||
- ``isStrictSubset(of:)-22f80``
|
||||
- ``isStrictSubset(of:)-5f78e``
|
||||
|
||||
- ``isStrictSuperset(of:)-7qgvz``
|
||||
- ``isStrictSuperset(of:)-3fdsl``
|
||||
- ``isStrictSuperset(of:)-2ujyn``
|
||||
- ``isStrictSuperset(of:)-4ryjr``
|
||||
- ``isStrictSuperset(of:)-3ephc``
|
||||
- ``isStrictSuperset(of:)-9ftlc``
|
||||
|
||||
- ``isDisjoint(with:)-eq16``
|
||||
- ``isDisjoint(with:)-8bgbj``
|
||||
- ``isDisjoint(with:)-5b64c``
|
||||
- ``isDisjoint(with:)-4a9xa``
|
||||
- ``isDisjoint(with:)-12a64``
|
||||
- ``isDisjoint(with:)-5lvdr``
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
# ``ShareableHashedCollections``
|
||||
# ``HashTreeCollections``
|
||||
|
||||
**Swift Collections** is an open-source package of data structure implementations for the Swift programming language.
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
|
||||
### Persistent Collections
|
||||
|
||||
- ``ShareableSet``
|
||||
- ``ShareableDictionary``
|
||||
- ``TreeSet``
|
||||
- ``TreeDictionary``
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -10,7 +10,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// A fixed-size array of just enough size to hold an ancestor path in a
|
||||
/// `ShareableDictionary`.
|
||||
/// `TreeDictionary`.
|
||||
@usableFromInline
|
||||
@frozen
|
||||
internal struct _Stack<Element> {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -11,7 +11,7 @@
|
||||
|
||||
// Code in this file is a slightly adapted variant of `Dictionary`'s `Codable`
|
||||
// implementation in the Standard Library as of Swift 5.7.
|
||||
// `ShareableDictionary` therefore encodes/decodes itself exactly the same as
|
||||
// `TreeDictionary` therefore encodes/decodes itself exactly the same as
|
||||
// `Dictionary`, and the two types can each decode data encoded by the other.
|
||||
|
||||
/// A wrapper for dictionary keys which are Strings or Ints.
|
||||
@@ -35,7 +35,7 @@ internal struct _DictionaryCodingKey: CodingKey {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary: Encodable
|
||||
extension TreeDictionary: Encodable
|
||||
where Key: Encodable, Value: Encodable
|
||||
{
|
||||
/// Encodes the elements of this dictionary into the given encoder.
|
||||
@@ -85,7 +85,7 @@ where Key: Encodable, Value: Encodable
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary: Decodable
|
||||
extension TreeDictionary: Decodable
|
||||
where Key: Decodable, Value: Decodable
|
||||
{
|
||||
/// Creates a new dictionary by decoding from the given decoder.
|
||||
+13
-13
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// The position of an element in a persistent dictionary.
|
||||
///
|
||||
/// An index in a persistent dictionary is a compact encoding of a path in
|
||||
@@ -39,11 +39,11 @@ extension ShareableDictionary {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Index: @unchecked Sendable
|
||||
extension TreeDictionary.Index: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Index: Equatable {
|
||||
extension TreeDictionary.Index: Equatable {
|
||||
/// Returns a Boolean value indicating whether two index values are equal.
|
||||
///
|
||||
/// Note that comparing two indices that do not belong to the same tree
|
||||
@@ -59,7 +59,7 @@ extension ShareableDictionary.Index: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Index: Comparable {
|
||||
extension TreeDictionary.Index: Comparable {
|
||||
/// Returns a Boolean value indicating whether the value of the first argument
|
||||
/// is less than the second argument.
|
||||
///
|
||||
@@ -75,7 +75,7 @@ extension ShareableDictionary.Index: Comparable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Index: Hashable {
|
||||
extension TreeDictionary.Index: Hashable {
|
||||
/// Hashes the essential components of this value by feeding them into the
|
||||
/// given hasher.
|
||||
///
|
||||
@@ -86,21 +86,21 @@ extension ShareableDictionary.Index: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Index: CustomStringConvertible {
|
||||
extension TreeDictionary.Index: CustomStringConvertible {
|
||||
// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_path.description
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Index: CustomDebugStringConvertible {
|
||||
extension TreeDictionary.Index: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
_path.description
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary: Collection {
|
||||
extension TreeDictionary: Collection {
|
||||
/// A Boolean value indicating whether the collection is empty.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@@ -198,7 +198,7 @@ extension ShareableDictionary: Collection {
|
||||
/// - Parameter start: A valid index of the collection.
|
||||
/// - Parameter end: Another valid index of the collection.
|
||||
/// - Returns: The distance between `start` and `end`.
|
||||
/// (The result can be negative, even though `ShareableDictionary` is not
|
||||
/// (The result can be negative, even though `TreeDictionary` is not
|
||||
/// a bidirectional collection.)
|
||||
/// - Complexity: O(log(`count`))
|
||||
@inlinable
|
||||
@@ -216,7 +216,7 @@ extension ShareableDictionary: Collection {
|
||||
/// - i: A valid index of the collection.
|
||||
/// - distance: The distance to offset `i`. As a special exception,
|
||||
/// `distance` is allowed to be negative even though
|
||||
/// `ShareableDictionary` isn't a bidirectional collection.
|
||||
/// `TreeDictionary` isn't a bidirectional collection.
|
||||
/// - Returns: An index offset by `distance` from the index `i`. If
|
||||
/// `distance` is positive, this is the same value as the result of
|
||||
/// `distance` calls to `index(after:)`. If distance is negative, then
|
||||
@@ -244,7 +244,7 @@ extension ShareableDictionary: Collection {
|
||||
/// - i: A valid index of the collection.
|
||||
/// - distance: The distance to offset `i`. As a special exception,
|
||||
/// `distance` is allowed to be negative even though
|
||||
/// `ShareableDictionary` isn't a bidirectional collection.
|
||||
/// `TreeDictionary` isn't a bidirectional collection.
|
||||
/// - limit: A valid index of the collection to use as a limit. If
|
||||
/// `distance > 0`, a limit that is less than `i` has no effect.
|
||||
/// Likewise, if `distance < 0`, a limit that is greater than `i` has no
|
||||
@@ -273,8 +273,8 @@ extension ShareableDictionary: Collection {
|
||||
#if false
|
||||
// Note: Let's not do this. `BidirectionalCollection` would imply that
|
||||
// the ordering of elements would be meaningful, which isn't true for
|
||||
// `ShareableDictionary`.
|
||||
extension ShareableDictionary: BidirectionalCollection {
|
||||
// `TreeDictionary`.
|
||||
extension TreeDictionary: BidirectionalCollection {
|
||||
/// Replaces the given index with its predecessor.
|
||||
///
|
||||
/// - Parameter i: A valid index of the collection.
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary: CustomReflectable {
|
||||
extension TreeDictionary: CustomReflectable {
|
||||
/// The custom mirror for this instance.
|
||||
public var customMirror: Mirror {
|
||||
Mirror(self, unlabeledChildren: self, displayStyle: .dictionary)
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// True if consistency checking is enabled in the implementation of this
|
||||
/// type, false otherwise.
|
||||
///
|
||||
+3
-3
@@ -11,14 +11,14 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableDictionary: CustomStringConvertible {
|
||||
extension TreeDictionary: CustomStringConvertible {
|
||||
// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_dictionaryDescription(for: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary: CustomDebugStringConvertible {
|
||||
extension TreeDictionary: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
_dictionaryDescription(
|
||||
@@ -26,6 +26,6 @@ extension ShareableDictionary: CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
internal static func _debugTypeName() -> String {
|
||||
"ShareableDictionary<\(Key.self), \(Value.self)>"
|
||||
"TreeDictionary<\(Key.self), \(Value.self)>"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary: Equatable where Value: Equatable {
|
||||
extension TreeDictionary: Equatable where Value: Equatable {
|
||||
/// Returns a Boolean value indicating whether two values are equal.
|
||||
///
|
||||
/// Two persistent dictionaries are considered equal if they contain the same
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary: ExpressibleByDictionaryLiteral {
|
||||
extension TreeDictionary: ExpressibleByDictionaryLiteral {
|
||||
/// Creates a new dictionary from the contents of a dictionary literal.
|
||||
///
|
||||
/// The literal must not contain duplicate elements.
|
||||
+3
-3
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Returns a new persistent dictionary containing the key-value pairs of this
|
||||
/// dictionary that satisfy the given predicate.
|
||||
///
|
||||
@@ -26,7 +26,7 @@ extension ShareableDictionary {
|
||||
) rethrows -> Self {
|
||||
let result = try _root.filter(.top, isIncluded)
|
||||
guard let result = result else { return self }
|
||||
return ShareableDictionary(_new: result.finalize(.top))
|
||||
return TreeDictionary(_new: result.finalize(.top))
|
||||
}
|
||||
|
||||
/// Removes all the elements that satisfy the given predicate.
|
||||
@@ -36,7 +36,7 @@ extension ShareableDictionary {
|
||||
/// This example removes all the odd valued items from a
|
||||
/// dictionary mapping strings to numbers:
|
||||
///
|
||||
/// var numbers: ShareableDictionary = ["a": 5, "b": 6, "c": 7, "d": 8]
|
||||
/// var numbers: TreeDictionary = ["a": 5, "b": 6, "c": 7, "d": 8]
|
||||
/// numbers.removeAll(where: { $0.value % 2 != 0 })
|
||||
/// // numbers == ["b": 6, "d": 8]
|
||||
///
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary: Hashable where Value: Hashable {
|
||||
extension TreeDictionary: Hashable where Value: Hashable {
|
||||
/// Hashes the essential components of this value by feeding them into the
|
||||
/// given hasher.
|
||||
///
|
||||
+10
-10
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Creates an empty dictionary.
|
||||
///
|
||||
/// This initializer is equivalent to initializing with an empty dictionary
|
||||
@@ -25,7 +25,7 @@ extension ShareableDictionary {
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@inlinable
|
||||
public init(_ other: ShareableDictionary<Key, Value>) {
|
||||
public init(_ other: TreeDictionary<Key, Value>) {
|
||||
self = other
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ extension ShareableDictionary {
|
||||
/// - Complexity: O(`other.count`)
|
||||
@inlinable
|
||||
public init(
|
||||
keys: ShareableSet<Key>,
|
||||
keys: TreeSet<Key>,
|
||||
valueGenerator valueTransform: (Key) throws -> Value
|
||||
) rethrows {
|
||||
// FIXME: This is a non-standard addition
|
||||
@@ -144,12 +144,12 @@ extension ShareableDictionary {
|
||||
///
|
||||
/// let pairsWithDuplicateKeys = [("a", 1), ("b", 2), ("a", 3), ("b", 4)]
|
||||
///
|
||||
/// let firstValues = ShareableDictionary(
|
||||
/// let firstValues = TreeDictionary(
|
||||
/// pairsWithDuplicateKeys,
|
||||
/// uniquingKeysWith: { (first, _) in first })
|
||||
/// // ["a": 1, "b": 2]
|
||||
///
|
||||
/// let lastValues = ShareableDictionary(
|
||||
/// let lastValues = TreeDictionary(
|
||||
/// pairsWithDuplicateKeys,
|
||||
/// uniquingKeysWith: { (_, last) in last })
|
||||
/// // ["a": 3, "b": 4]
|
||||
@@ -183,12 +183,12 @@ extension ShareableDictionary {
|
||||
///
|
||||
/// let pairsWithDuplicateKeys = [("a", 1), ("b", 2), ("a", 3), ("b", 4)]
|
||||
///
|
||||
/// let firstValues = ShareableDictionary(
|
||||
/// let firstValues = TreeDictionary(
|
||||
/// pairsWithDuplicateKeys,
|
||||
/// uniquingKeysWith: { (first, _) in first })
|
||||
/// // ["a": 1, "b": 2]
|
||||
///
|
||||
/// let lastValues = ShareableDictionary(
|
||||
/// let lastValues = TreeDictionary(
|
||||
/// pairsWithDuplicateKeys,
|
||||
/// uniquingKeysWith: { (_, last) in last })
|
||||
/// // ["a": 3, "b": 4]
|
||||
@@ -212,7 +212,7 @@ extension ShareableDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Creates a new dictionary whose keys are the groupings returned by the
|
||||
/// given closure and whose values are arrays of the elements that returned
|
||||
/// each key.
|
||||
@@ -225,7 +225,7 @@ extension ShareableDictionary {
|
||||
/// dictionary from that array by grouping the names by first letter:
|
||||
///
|
||||
/// let students = ["Kofi", "Abena", "Efua", "Kweku", "Akosua"]
|
||||
/// let studentsByLetter = ShareableDictionary(grouping: students, by: { $0.first! })
|
||||
/// let studentsByLetter = TreeDictionary(grouping: students, by: { $0.first! })
|
||||
/// // ["K": ["Kofi", "Kweku"], "A": ["Abena", "Akosua"], "E": ["Efua"]]
|
||||
///
|
||||
/// The new `studentsByLetter` dictionary has three entries, with students'
|
||||
@@ -260,7 +260,7 @@ extension ShareableDictionary {
|
||||
/// dictionary from that array by grouping the names by first letter:
|
||||
///
|
||||
/// let students = ["Kofi", "Abena", "Efua", "Kweku", "Akosua"]
|
||||
/// let studentsByLetter = ShareableDictionary(grouping: students, by: { $0.first! })
|
||||
/// let studentsByLetter = TreeDictionary(grouping: students, by: { $0.first! })
|
||||
/// // ["K": ["Kofi", "Kweku"], "A": ["Abena", "Akosua"], "E": ["Efua"]]
|
||||
///
|
||||
/// The new `studentsByLetter` dictionary has three entries, with students'
|
||||
+34
-34
@@ -11,18 +11,18 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// A view of a persistent dictionary’s keys, as a standalone collection.
|
||||
@frozen
|
||||
public struct Keys {
|
||||
@usableFromInline
|
||||
internal typealias _Node = ShareableHashedCollections._Node<Key, Value>
|
||||
internal typealias _Node = HashTreeCollections._Node<Key, Value>
|
||||
|
||||
@usableFromInline
|
||||
internal var _base: ShareableDictionary
|
||||
internal var _base: TreeDictionary
|
||||
|
||||
@inlinable
|
||||
internal init(_base: ShareableDictionary) {
|
||||
internal init(_base: TreeDictionary) {
|
||||
self._base = _base
|
||||
}
|
||||
}
|
||||
@@ -37,30 +37,30 @@ extension ShareableDictionary {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Keys: Sendable
|
||||
extension TreeDictionary.Keys: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Keys: _UniqueCollection {}
|
||||
extension TreeDictionary.Keys: _UniqueCollection {}
|
||||
|
||||
extension ShareableDictionary.Keys: CustomStringConvertible {
|
||||
extension TreeDictionary.Keys: CustomStringConvertible {
|
||||
// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_arrayDescription(for: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Keys: CustomDebugStringConvertible {
|
||||
extension TreeDictionary.Keys: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
_arrayDescription(
|
||||
for: self,
|
||||
debug: true,
|
||||
typeName: "\(ShareableDictionary._debugTypeName()).Keys")
|
||||
typeName: "\(TreeDictionary._debugTypeName()).Keys")
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Keys: Sequence {
|
||||
extension TreeDictionary.Keys: Sequence {
|
||||
/// The element type of the collection.
|
||||
public typealias Element = Key
|
||||
|
||||
@@ -71,10 +71,10 @@ extension ShareableDictionary.Keys: Sequence {
|
||||
public typealias Element = Key
|
||||
|
||||
@usableFromInline
|
||||
internal var _base: ShareableDictionary.Iterator
|
||||
internal var _base: TreeDictionary.Iterator
|
||||
|
||||
@inlinable
|
||||
internal init(_base: ShareableDictionary.Iterator) {
|
||||
internal init(_base: TreeDictionary.Iterator) {
|
||||
self._base = _base
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ extension ShareableDictionary.Keys: Sequence {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Keys.Iterator: Sendable
|
||||
extension TreeDictionary.Keys.Iterator: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Keys: Collection {
|
||||
public typealias Index = ShareableDictionary.Index
|
||||
extension TreeDictionary.Keys: Collection {
|
||||
public typealias Index = TreeDictionary.Index
|
||||
|
||||
@inlinable
|
||||
public var isEmpty: Bool { _base.isEmpty }
|
||||
@@ -166,10 +166,10 @@ extension ShareableDictionary.Keys: Collection {
|
||||
}
|
||||
|
||||
#if false
|
||||
extension ShareableDictionary.Keys: BidirectionalCollection {
|
||||
extension TreeDictionary.Keys: BidirectionalCollection {
|
||||
// Note: Let's not do this. `BidirectionalCollection` would imply that
|
||||
// the ordering of elements would be meaningful, which isn't true for
|
||||
// `ShareableDictionary.Keys`.
|
||||
// `TreeDictionary.Keys`.
|
||||
@inlinable
|
||||
public func formIndex(before i: inout Index) {
|
||||
_base.formIndex(before: &i)
|
||||
@@ -182,12 +182,12 @@ extension ShareableDictionary.Keys: BidirectionalCollection {
|
||||
}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Keys {
|
||||
extension TreeDictionary.Keys {
|
||||
/// Returns a new keys view with the elements that are common to both this
|
||||
/// view and the provided other one.
|
||||
///
|
||||
/// var a: ShareableDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: ShareableDictionary = ["b": 4, "d": 5, "e": 6]
|
||||
/// var a: TreeDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: TreeDictionary = ["b": 4, "d": 5, "e": 6]
|
||||
/// let c = a.keys.intersection(b.keys)
|
||||
/// // `c` is `["b"]`
|
||||
///
|
||||
@@ -204,19 +204,19 @@ extension ShareableDictionary.Keys {
|
||||
/// hash tree structure to minimize work when possible, e.g. by linking
|
||||
/// parts of the input trees directly into the result.
|
||||
public func intersection<Value2>(
|
||||
_ other: ShareableDictionary<Key, Value2>.Keys
|
||||
_ other: TreeDictionary<Key, Value2>.Keys
|
||||
) -> Self {
|
||||
guard let r = _base._root.intersection(.top, other._base._root) else {
|
||||
return self
|
||||
}
|
||||
return ShareableDictionary(_new: r).keys
|
||||
return TreeDictionary(_new: r).keys
|
||||
}
|
||||
|
||||
/// Returns a new keys view with the elements that are common to both this
|
||||
/// view and the provided persistent set.
|
||||
///
|
||||
/// var a: ShareableDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: ShareableSet = ["b", "d", "e"]
|
||||
/// var a: TreeDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: TreeSet = ["b", "d", "e"]
|
||||
/// let c = a.keys.intersection(b)
|
||||
/// // `c` is `["b"]`
|
||||
///
|
||||
@@ -231,18 +231,18 @@ extension ShareableDictionary.Keys {
|
||||
/// However, the implementation is careful to make the best use of
|
||||
/// hash tree structure to minimize work when possible, e.g. by linking
|
||||
/// parts of the input trees directly into the result.
|
||||
public func intersection(_ other: ShareableSet<Key>) -> Self {
|
||||
public func intersection(_ other: TreeSet<Key>) -> Self {
|
||||
guard let r = _base._root.intersection(.top, other._root) else {
|
||||
return self
|
||||
}
|
||||
return ShareableDictionary(_new: r).keys
|
||||
return TreeDictionary(_new: r).keys
|
||||
}
|
||||
|
||||
/// Returns a new keys view containing the elements of `self` that do not
|
||||
/// occur in the provided other one.
|
||||
///
|
||||
/// var a: ShareableDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: ShareableDictionary = ["b": 4, "d": 5, "e": 6]
|
||||
/// var a: TreeDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: TreeDictionary = ["b": 4, "d": 5, "e": 6]
|
||||
/// let c = a.keys.subtracting(b.keys)
|
||||
/// // `c` is some permutation of `["a", "c"]`
|
||||
///
|
||||
@@ -255,19 +255,19 @@ extension ShareableDictionary.Keys {
|
||||
/// hash tree structure to minimize work when possible, e.g. by linking
|
||||
/// parts of the input trees directly into the result.
|
||||
public func subtracting<Value2>(
|
||||
_ other: ShareableDictionary<Key, Value2>.Keys
|
||||
_ other: TreeDictionary<Key, Value2>.Keys
|
||||
) -> Self {
|
||||
guard let r = _base._root.subtracting(.top, other._base._root) else {
|
||||
return self
|
||||
}
|
||||
return ShareableDictionary(_new: r).keys
|
||||
return TreeDictionary(_new: r).keys
|
||||
}
|
||||
|
||||
/// Returns a new keys view containing the elements of `self` that do not
|
||||
/// occur in the provided persistent set.
|
||||
///
|
||||
/// var a: ShareableDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: ShareableSet = ["b", "d", "e"]
|
||||
/// var a: TreeDictionary = ["a": 1, "b": 2, "c": 3]
|
||||
/// let b: TreeSet = ["b", "d", "e"]
|
||||
/// let c = a.keys.subtracting(b)
|
||||
/// // `c` is some permutation of `["a", "c"]`
|
||||
///
|
||||
@@ -278,10 +278,10 @@ extension ShareableDictionary.Keys {
|
||||
/// However, the implementation is careful to make the best use of
|
||||
/// hash tree structure to minimize work when possible, e.g. by linking
|
||||
/// parts of the input trees directly into the result.
|
||||
public func subtracting(_ other: ShareableSet<Key>) -> Self {
|
||||
public func subtracting(_ other: TreeSet<Key>) -> Self {
|
||||
guard let r = _base._root.subtracting(.top, other._root) else {
|
||||
return self
|
||||
}
|
||||
return ShareableDictionary(_new: r).keys
|
||||
return TreeDictionary(_new: r).keys
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Returns a new dictionary containing the keys of this dictionary with the
|
||||
/// values transformed by the given closure.
|
||||
///
|
||||
@@ -23,9 +23,9 @@ extension ShareableDictionary {
|
||||
@inlinable
|
||||
public func mapValues<T>(
|
||||
_ transform: (Value) throws -> T
|
||||
) rethrows -> ShareableDictionary<Key, T> {
|
||||
) rethrows -> TreeDictionary<Key, T> {
|
||||
let transformed = try _root.mapValues { try transform($0.value) }
|
||||
return ShareableDictionary<Key, T>(_new: transformed)
|
||||
return TreeDictionary<Key, T>(_new: transformed)
|
||||
}
|
||||
|
||||
/// Returns a new dictionary containing only the key-value pairs that have
|
||||
@@ -38,7 +38,7 @@ extension ShareableDictionary {
|
||||
/// and `compactMapValues` with a transformation that returns an optional
|
||||
/// `Int` value.
|
||||
///
|
||||
/// let data: ShareableDictionary = ["a": "1", "b": "three", "c": "///4///"]
|
||||
/// let data: TreeDictionary = ["a": "1", "b": "three", "c": "///4///"]
|
||||
///
|
||||
/// let m: [String: Int?] = data.mapValues { str in Int(str) }
|
||||
/// // ["a": Optional(1), "b": nil, "c": nil]
|
||||
@@ -57,8 +57,8 @@ extension ShareableDictionary {
|
||||
@inlinable
|
||||
public func compactMapValues<T>(
|
||||
_ transform: (Value) throws -> T?
|
||||
) rethrows -> ShareableDictionary<Key, T> {
|
||||
) rethrows -> TreeDictionary<Key, T> {
|
||||
let result = try _root.compactMapValues(.top, transform)
|
||||
return ShareableDictionary<Key, T>(_new: result.finalize(.top))
|
||||
return TreeDictionary<Key, T>(_new: result.finalize(.top))
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Merges the key-value pairs in the given sequence into the dictionary,
|
||||
/// using a combining closure to determine the value for any duplicate keys.
|
||||
///
|
||||
@@ -22,7 +22,7 @@ extension ShareableDictionary {
|
||||
/// This example shows how to choose the current or new values for any
|
||||
/// duplicate keys:
|
||||
///
|
||||
/// var dictionary: ShareableDictionary = ["a": 1, "b": 2]
|
||||
/// var dictionary: TreeDictionary = ["a": 1, "b": 2]
|
||||
///
|
||||
/// // Keeping existing value for key "a":
|
||||
/// dictionary.merge(zip(["a", "c"], [3, 4])) { (current, _) in current }
|
||||
@@ -58,7 +58,7 @@ extension ShareableDictionary {
|
||||
/// This example shows how to choose the current or new values for any
|
||||
/// duplicate keys:
|
||||
///
|
||||
/// var dictionary: ShareableDictionary = ["a": 1, "b": 2]
|
||||
/// var dictionary: TreeDictionary = ["a": 1, "b": 2]
|
||||
///
|
||||
/// // Keeping existing value for key "a":
|
||||
/// dictionary.merge(zip(["a", "c"], [3, 4])) { (current, _) in current }
|
||||
@@ -101,7 +101,7 @@ extension ShareableDictionary {
|
||||
/// This example shows how to choose the current or new values for any
|
||||
/// duplicate keys:
|
||||
///
|
||||
/// var dictionary: ShareableDictionary = ["a": 1, "b": 2]
|
||||
/// var dictionary: TreeDictionary = ["a": 1, "b": 2]
|
||||
///
|
||||
/// // Keeping existing value for key "a":
|
||||
/// dictionary.merge(zip(["a", "c"], [3, 4])) { (current, _) in current }
|
||||
+1
-1
@@ -10,6 +10,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary: @unchecked Sendable
|
||||
extension TreeDictionary: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
+3
-3
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableDictionary: Sequence {
|
||||
extension TreeDictionary: Sequence {
|
||||
/// The element type of a dictionary: a tuple containing an individual
|
||||
/// key-value pair.
|
||||
public typealias Element = (key: Key, value: Value)
|
||||
@@ -52,11 +52,11 @@ extension ShareableDictionary: Sequence {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Iterator: @unchecked Sendable
|
||||
extension TreeDictionary.Iterator: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Iterator: IteratorProtocol {
|
||||
extension TreeDictionary.Iterator: IteratorProtocol {
|
||||
/// The element type of a dictionary: a tuple containing an individual
|
||||
/// key-value pair.
|
||||
public typealias Element = (key: Key, value: Value)
|
||||
+16
-16
@@ -11,21 +11,21 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// A view of a dictionary’s values.
|
||||
@frozen
|
||||
public struct Values {
|
||||
@usableFromInline
|
||||
internal typealias _Node = ShareableHashedCollections._Node<Key, Value>
|
||||
internal typealias _Node = HashTreeCollections._Node<Key, Value>
|
||||
|
||||
@usableFromInline
|
||||
internal typealias _UnsafeHandle = _Node.UnsafeHandle
|
||||
|
||||
@usableFromInline
|
||||
internal var _base: ShareableDictionary
|
||||
internal var _base: TreeDictionary
|
||||
|
||||
@inlinable
|
||||
internal init(_base: ShareableDictionary) {
|
||||
internal init(_base: TreeDictionary) {
|
||||
self._base = _base
|
||||
}
|
||||
}
|
||||
@@ -42,28 +42,28 @@ extension ShareableDictionary {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Values: Sendable
|
||||
extension TreeDictionary.Values: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableDictionary.Values: CustomStringConvertible {
|
||||
extension TreeDictionary.Values: CustomStringConvertible {
|
||||
// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_arrayDescription(for: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Values: CustomDebugStringConvertible {
|
||||
extension TreeDictionary.Values: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
_arrayDescription(
|
||||
for: self,
|
||||
debug: true,
|
||||
typeName: "\(ShareableDictionary._debugTypeName()).Values")
|
||||
typeName: "\(TreeDictionary._debugTypeName()).Values")
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary.Values: Sequence {
|
||||
extension TreeDictionary.Values: Sequence {
|
||||
public typealias Element = Value
|
||||
|
||||
@frozen
|
||||
@@ -71,10 +71,10 @@ extension ShareableDictionary.Values: Sequence {
|
||||
public typealias Element = Value
|
||||
|
||||
@usableFromInline
|
||||
internal var _base: ShareableDictionary.Iterator
|
||||
internal var _base: TreeDictionary.Iterator
|
||||
|
||||
@inlinable
|
||||
internal init(_base: ShareableDictionary.Iterator) {
|
||||
internal init(_base: TreeDictionary.Iterator) {
|
||||
self._base = _base
|
||||
}
|
||||
|
||||
@@ -91,14 +91,14 @@ extension ShareableDictionary.Values: Sequence {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableDictionary.Values.Iterator: Sendable
|
||||
extension TreeDictionary.Values.Iterator: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
// Note: This cannot be a MutableCollection because its subscript setter
|
||||
// needs to invalidate indices.
|
||||
extension ShareableDictionary.Values: Collection {
|
||||
public typealias Index = ShareableDictionary.Index
|
||||
extension TreeDictionary.Values: Collection {
|
||||
public typealias Index = TreeDictionary.Index
|
||||
|
||||
@inlinable
|
||||
public var isEmpty: Bool { _base.isEmpty }
|
||||
@@ -152,10 +152,10 @@ extension ShareableDictionary.Values: Collection {
|
||||
}
|
||||
|
||||
#if false
|
||||
extension ShareableDictionary.Values: BidirectionalCollection {
|
||||
extension TreeDictionary.Values: BidirectionalCollection {
|
||||
// Note: Let's not do this. `BidirectionalCollection` would imply that
|
||||
// the ordering of elements would be meaningful, which isn't true for
|
||||
// `ShareableDictionary.Values`.
|
||||
// `TreeDictionary.Values`.
|
||||
@inlinable
|
||||
public func formIndex(before i: inout Index) {
|
||||
_base.formIndex(before: &i)
|
||||
+19
-18
@@ -13,24 +13,25 @@
|
||||
/// mutating shared copies and comparing different snapshots of the same
|
||||
/// collection.
|
||||
///
|
||||
/// `ShareableDictionary` has the same functionality as a standard
|
||||
/// `TreeDictionary` has the same functionality as a standard
|
||||
/// `Dictionary`, and it largely implements the same APIs: both are hashed
|
||||
/// collection types with convenient and efficient ways to look up the value
|
||||
/// associated with a particular key, and both types are unordered, meaning that
|
||||
/// neither type provides any guarantees about the ordering of their items.
|
||||
///
|
||||
/// However, `ShareableDictionary` is optimizing specifically for use cases
|
||||
/// However, `TreeDictionary` is optimizing specifically for use cases
|
||||
/// that need to mutate shared copies or to compare a dictionary value to one of
|
||||
/// its older snapshots.
|
||||
/// its older snapshots. To use a term from functional programming,
|
||||
/// `TreeDictionary` implements a _persistent data structure_.
|
||||
///
|
||||
/// The standard `Dictionary` stores its members in a single, flat hash table,
|
||||
/// and it implements value semantics with all-or-nothing copy-on-write
|
||||
/// behavior: every time a shared copy of a dictionary is mutated, the mutation
|
||||
/// needs to make a full copy of the dictionary's storage.
|
||||
/// `ShareableDictionary` takes a different approach: it organizes its members
|
||||
/// `TreeDictionary` takes a different approach: it organizes its members
|
||||
/// into a tree structure, the nodes of which can be freely shared across
|
||||
/// collection values. When mutating a shared copy of a dictionary value,
|
||||
/// `ShareableDictionary` is able to simply link the unchanged parts of the
|
||||
/// `TreeDictionary` is able to simply link the unchanged parts of the
|
||||
/// tree directly into the result, saving both time and memory.
|
||||
///
|
||||
/// This structural sharing also makes it more efficient to compare mutated
|
||||
@@ -39,7 +40,7 @@
|
||||
/// typically be handled in constant time, leading to a dramatic performance
|
||||
/// boost when the two inputs are still largely unchanged:
|
||||
///
|
||||
/// var d = ShareableDictionary(
|
||||
/// var d = TreeDictionary(
|
||||
/// uniqueKeysWithValues: (0 ..< 10_000).map { ($0, 2 * $0) })
|
||||
/// let copy = d
|
||||
/// d[20_000] = 42 // Expected to be an O(log(n)) operation
|
||||
@@ -47,7 +48,7 @@
|
||||
/// // `diff` now holds the single item 20_000.
|
||||
///
|
||||
/// The tree structure also eliminates the need to reserve capacity in advance:
|
||||
/// `ShareableDictionary` creates, destroys and resizes individual nodes as
|
||||
/// `TreeDictionary` creates, destroys and resizes individual nodes as
|
||||
/// needed, always consuming just enough memory to store its contents. As of
|
||||
/// Swift 5.7, the standard collection types never shrink their storage, so
|
||||
/// temporary storage spikes can linger as unused but still allocated memory
|
||||
@@ -55,16 +56,16 @@
|
||||
///
|
||||
/// Of course, switching to a tree structure comes with some trade offs. In
|
||||
/// particular, inserting new items, removing existing ones, and iterating over
|
||||
/// a `ShareableDictionary` is expected to be a constant factor slower than a
|
||||
/// a `TreeDictionary` is expected to be a constant factor slower than a
|
||||
/// standard `Dictionary` -- allocating/deallocating nodes isn't free, and
|
||||
/// navigating the tree structure requires more pointer dereferences than
|
||||
/// accessing a flat hash table. However the algorithmic improvements above
|
||||
/// usually more than make up for this, as long as the use case can make use of
|
||||
/// them.
|
||||
@frozen // Not really -- this package is not at all ABI stable
|
||||
public struct ShareableDictionary<Key: Hashable, Value> {
|
||||
public struct TreeDictionary<Key: Hashable, Value> {
|
||||
@usableFromInline
|
||||
internal typealias _Node = ShareableHashedCollections._Node<Key, Value>
|
||||
internal typealias _Node = HashTreeCollections._Node<Key, Value>
|
||||
|
||||
@usableFromInline
|
||||
internal typealias _UnsafeHandle = _Node.UnsafeHandle
|
||||
@@ -90,7 +91,7 @@ public struct ShareableDictionary<Key: Hashable, Value> {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableDictionary {
|
||||
extension TreeDictionary {
|
||||
/// Accesses the value associated with the given key for reading and writing.
|
||||
///
|
||||
/// This *key-based* subscript returns the value for the given key if the key
|
||||
@@ -100,7 +101,7 @@ extension ShareableDictionary {
|
||||
/// key found in the dictionary (`"Coral"`) and a key not found in the
|
||||
/// dictionary (`"Cerise"`).
|
||||
///
|
||||
/// var hues: ShareableDictionary = ["Heliotrope": 296, "Coral": 16, "Aquamarine": 156]
|
||||
/// var hues: TreeDictionary = ["Heliotrope": 296, "Coral": 16, "Aquamarine": 156]
|
||||
/// print(hues["Coral"])
|
||||
/// // Prints "Optional(16)"
|
||||
/// print(hues["Cerise"])
|
||||
@@ -186,7 +187,7 @@ extension ShareableDictionary {
|
||||
/// example uses the subscript with a message to use in case an HTTP response
|
||||
/// code isn't recognized:
|
||||
///
|
||||
/// var responseMessages: ShareableDictionary = [
|
||||
/// var responseMessages: TreeDictionary = [
|
||||
/// 200: "OK",
|
||||
/// 403: "Access forbidden",
|
||||
/// 404: "File not found",
|
||||
@@ -207,7 +208,7 @@ extension ShareableDictionary {
|
||||
/// of each letter in a string:
|
||||
///
|
||||
/// let message = "Hello, Elle!"
|
||||
/// var letterCounts: ShareableDictionary<Character, Int> = [:]
|
||||
/// var letterCounts: TreeDictionary<Character, Int> = [:]
|
||||
/// for letter in message {
|
||||
/// letterCounts[letter, default: 0] += 1
|
||||
/// }
|
||||
@@ -298,7 +299,7 @@ extension ShareableDictionary {
|
||||
/// value of an existing key is updated, `updateValue(_:forKey:)` returns
|
||||
/// the original value.
|
||||
///
|
||||
/// var hues: ShareableDictionary = [
|
||||
/// var hues: TreeDictionary = [
|
||||
/// "Heliotrope": 296,
|
||||
/// "Coral": 16,
|
||||
/// "Aquamarine": 156]
|
||||
@@ -383,7 +384,7 @@ extension ShareableDictionary {
|
||||
/// in a string:
|
||||
///
|
||||
/// let message = "Hello, Elle!"
|
||||
/// var letterCounts: ShareableDictionary<Character, Int> = [:]
|
||||
/// var letterCounts: TreeDictionary<Character, Int> = [:]
|
||||
/// for letter in message {
|
||||
/// letterCounts.updateValue(forKey: letter) { count in
|
||||
/// if count == nil {
|
||||
@@ -434,7 +435,7 @@ extension ShareableDictionary {
|
||||
/// in a string:
|
||||
///
|
||||
/// let message = "Hello, Elle!"
|
||||
/// var letterCounts: ShareableDictionary<Character, Int> = [:]
|
||||
/// var letterCounts: TreeDictionary<Character, Int> = [:]
|
||||
/// for letter in message {
|
||||
/// letterCounts.updateValue(forKey: letter, default: 0) { count in
|
||||
/// count += 1
|
||||
@@ -483,7 +484,7 @@ extension ShareableDictionary {
|
||||
/// If the key is found in the dictionary, this method returns the key's
|
||||
/// associated value, and invalidates all previously returned indices.
|
||||
///
|
||||
/// var hues: ShareableDictionary = [
|
||||
/// var hues: TreeDictionary = [
|
||||
/// "Heliotrope": 296,
|
||||
/// "Coral": 16,
|
||||
/// "Aquamarine": 156]
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet: Encodable where Element: Encodable {
|
||||
extension TreeSet: Encodable where Element: Encodable {
|
||||
/// Encodes the elements of this set into the given encoder.
|
||||
///
|
||||
/// - Parameter encoder: The encoder to write data to.
|
||||
@@ -20,7 +20,7 @@ extension ShareableSet: Encodable where Element: Encodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet: Decodable where Element: Decodable {
|
||||
extension TreeSet: Decodable where Element: Decodable {
|
||||
/// Creates a new set by decoding from the given decoder.
|
||||
///
|
||||
/// This initializer throws an error if reading from the decoder fails, or
|
||||
+13
-13
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// The position of an element in a persistent set.
|
||||
///
|
||||
/// An index in a persistent set is a compact encoding of a path in the
|
||||
@@ -39,11 +39,11 @@ extension ShareableSet {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableSet.Index: @unchecked Sendable
|
||||
extension TreeSet.Index: @unchecked Sendable
|
||||
where Element: Sendable {}
|
||||
#endif
|
||||
|
||||
extension ShareableSet.Index: Equatable {
|
||||
extension TreeSet.Index: Equatable {
|
||||
/// Returns a Boolean value indicating whether two index values are equal.
|
||||
///
|
||||
/// Note that comparing two indices that do not belong to the same tree
|
||||
@@ -59,7 +59,7 @@ extension ShareableSet.Index: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet.Index: Comparable {
|
||||
extension TreeSet.Index: Comparable {
|
||||
/// Returns a Boolean value indicating whether the value of the first argument
|
||||
/// is less than the second argument.
|
||||
///
|
||||
@@ -76,7 +76,7 @@ extension ShareableSet.Index: Comparable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet.Index: Hashable {
|
||||
extension TreeSet.Index: Hashable {
|
||||
/// Hashes the essential components of this value by feeding them into the
|
||||
/// given hasher.
|
||||
///
|
||||
@@ -87,21 +87,21 @@ extension ShareableSet.Index: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet.Index: CustomStringConvertible {
|
||||
extension TreeSet.Index: CustomStringConvertible {
|
||||
// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_path.description
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet.Index: CustomDebugStringConvertible {
|
||||
extension TreeSet.Index: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
description
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet: Collection {
|
||||
extension TreeSet: Collection {
|
||||
/// A Boolean value indicating whether the collection is empty.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@@ -198,7 +198,7 @@ extension ShareableSet: Collection {
|
||||
/// - Parameter start: A valid index of the collection.
|
||||
/// - Parameter end: Another valid index of the collection.
|
||||
/// - Returns: The distance between `start` and `end`.
|
||||
/// (The result can be negative, even though `ShareableSet` is not a
|
||||
/// (The result can be negative, even though `TreeSet` is not a
|
||||
/// bidirectional collection.)
|
||||
/// - Complexity: O(log(`count`))
|
||||
@inlinable
|
||||
@@ -215,7 +215,7 @@ extension ShareableSet: Collection {
|
||||
/// - Parameters:
|
||||
/// - i: A valid index of the collection.
|
||||
/// - distance: The distance to offset `i`. As a special exception,
|
||||
/// `distance` is allowed to be negative even though `ShareableSet`
|
||||
/// `distance` is allowed to be negative even though `TreeSet`
|
||||
/// isn't a bidirectional collection.
|
||||
/// - Returns: An index offset by `distance` from the index `i`. If
|
||||
/// `distance` is positive, this is the same value as the result of
|
||||
@@ -243,7 +243,7 @@ extension ShareableSet: Collection {
|
||||
/// - Parameters:
|
||||
/// - i: A valid index of the collection.
|
||||
/// - distance: The distance to offset `i`. As a special exception,
|
||||
/// `distance` is allowed to be negative even though `ShareableSet`
|
||||
/// `distance` is allowed to be negative even though `TreeSet`
|
||||
/// isn't a bidirectional collection.
|
||||
/// - limit: A valid index of the collection to use as a limit. If
|
||||
/// `distance > 0`, a limit that is less than `i` has no effect.
|
||||
@@ -340,8 +340,8 @@ extension ShareableSet: Collection {
|
||||
#if false
|
||||
// Note: Let's not do this. `BidirectionalCollection` would imply that
|
||||
// the ordering of elements would be meaningful, which isn't true for
|
||||
// `ShareableSet`.
|
||||
extension ShareableSet: BidirectionalCollection {
|
||||
// `TreeSet`.
|
||||
extension TreeSet: BidirectionalCollection {
|
||||
/// Replaces the given index with its predecessor.
|
||||
///
|
||||
/// - Parameter i: A valid index of the collection.
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet: CustomReflectable {
|
||||
extension TreeSet: CustomReflectable {
|
||||
/// The custom mirror for this instance.
|
||||
public var customMirror: Mirror {
|
||||
Mirror(self, unlabeledChildren: self, displayStyle: .set)
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// True if consistency checking is enabled in the implementation of this
|
||||
/// type, false otherwise.
|
||||
///
|
||||
+3
-3
@@ -11,14 +11,14 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet: CustomStringConvertible {
|
||||
extension TreeSet: CustomStringConvertible {
|
||||
/// A textual representation of this instance.
|
||||
public var description: String {
|
||||
_arrayDescription(for: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension ShareableSet: CustomDebugStringConvertible {
|
||||
extension TreeSet: CustomDebugStringConvertible {
|
||||
/// A textual representation of this instance, suitable for debugging.
|
||||
public var debugDescription: String {
|
||||
_arrayDescription(
|
||||
@@ -26,6 +26,6 @@ extension ShareableSet: CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
internal func _debugTypeName() -> String {
|
||||
"ShareableSet<\(Element.self)>"
|
||||
"TreeSet<\(Element.self)>"
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -11,13 +11,13 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet: Equatable {
|
||||
extension TreeSet: Equatable {
|
||||
/// Returns a Boolean value indicating whether two values are equal.
|
||||
///
|
||||
/// Two persistent sets are considered equal if they contain the same
|
||||
/// elements, but not necessarily in the same order.
|
||||
///
|
||||
/// - Note: This simply forwards to the ``isEqualSet(to:)-5lpwv`` method.
|
||||
/// - Note: This simply forwards to the ``isEqualSet(to:)-4bc1i`` method.
|
||||
/// That method has additional overloads that can be used to compare
|
||||
/// persistent sets with additional types.
|
||||
///
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet: ExpressibleByArrayLiteral {
|
||||
extension TreeSet: ExpressibleByArrayLiteral {
|
||||
/// Creates a new set from the contents of an array literal.
|
||||
///
|
||||
/// Duplicate elements in the literal are allowed, but the resulting
|
||||
+2
-2
@@ -11,9 +11,9 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet: _UniqueCollection {}
|
||||
extension TreeSet: _UniqueCollection {}
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Removes the element at the given valid index.
|
||||
///
|
||||
/// Calling this method invalidates all existing indices of the collection.
|
||||
+3
-3
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a new persistent set containing all the members of this persistent
|
||||
/// set that satisfy the given predicate.
|
||||
///
|
||||
@@ -26,7 +26,7 @@ extension ShareableSet {
|
||||
) rethrows -> Self {
|
||||
let result = try _root.filter(.top) { try isIncluded($0.key) }
|
||||
guard let result = result else { return self }
|
||||
return ShareableSet(_new: result.finalize(.top))
|
||||
return TreeSet(_new: result.finalize(.top))
|
||||
}
|
||||
|
||||
/// Removes all the elements that satisfy the given predicate.
|
||||
@@ -36,7 +36,7 @@ extension ShareableSet {
|
||||
/// This example removes all the odd values from a
|
||||
/// set of numbers:
|
||||
///
|
||||
/// var numbers: ShareableSet = [5, 6, 7, 8, 9, 10, 11]
|
||||
/// var numbers: TreeSet = [5, 6, 7, 8, 9, 10, 11]
|
||||
/// numbers.removeAll(where: { $0 % 2 != 0 })
|
||||
/// // numbers == [6, 8, 10]
|
||||
///
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet: Hashable {
|
||||
extension TreeSet: Hashable {
|
||||
/// Hashes the essential components of this value by feeding them into the
|
||||
/// given hasher.
|
||||
///
|
||||
+1
-1
@@ -10,5 +10,5 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableSet: @unchecked Sendable where Element: Sendable {}
|
||||
extension TreeSet: @unchecked Sendable where Element: Sendable {}
|
||||
#endif
|
||||
+3
-3
@@ -9,8 +9,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet: Sequence {
|
||||
/// An iterator over the members of a `ShareableSet`.
|
||||
extension TreeSet: Sequence {
|
||||
/// An iterator over the members of a `TreeSet`.
|
||||
@frozen
|
||||
public struct Iterator: IteratorProtocol {
|
||||
@usableFromInline
|
||||
@@ -50,6 +50,6 @@ extension ShareableSet: Sequence {
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension ShareableSet.Iterator: @unchecked Sendable
|
||||
extension TreeSet.Iterator: @unchecked Sendable
|
||||
where Element: Sendable {}
|
||||
#endif
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Creates an empty set.
|
||||
///
|
||||
/// This initializer is equivalent to initializing with an empty array
|
||||
@@ -62,7 +62,7 @@ extension ShareableSet {
|
||||
/// - Complexity: O(*items.count*)
|
||||
@inlinable
|
||||
public init<Value>(
|
||||
_ item: __owned ShareableDictionary<Element, Value>.Keys
|
||||
_ item: __owned TreeDictionary<Element, Value>.Keys
|
||||
) {
|
||||
self.init(_new: item._base._root.mapValues { _ in () })
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet: SetAlgebra {
|
||||
extension TreeSet: SetAlgebra {
|
||||
/// Returns a Boolean value that indicates whether the given element exists
|
||||
/// in the set.
|
||||
///
|
||||
+5
-5
@@ -9,11 +9,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Removes the elements of this set that aren't also in the given one.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// a.formIntersection(b)
|
||||
/// // `a` is now some permutation of `[2, 4]`
|
||||
///
|
||||
@@ -50,7 +50,7 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable
|
||||
public mutating func formIntersection<Value>(
|
||||
_ other: ShareableDictionary<Element, Value>.Keys
|
||||
_ other: TreeDictionary<Element, Value>.Keys
|
||||
) {
|
||||
// FIXME: Implement in-place reductions
|
||||
self = intersection(other)
|
||||
@@ -58,7 +58,7 @@ extension ShareableSet {
|
||||
|
||||
/// Removes the elements of this set that aren't also in the given sequence.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6]
|
||||
/// a.formIntersection(b)
|
||||
/// // `a` is now some permutation of `[2, 4]`
|
||||
+7
-7
@@ -9,12 +9,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Replace this set with the elements contained in this set or the given
|
||||
/// set, but not both.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// a.formSymmetricDifference(b)
|
||||
/// // `a` is now some permutation of `[0, 1, 3, 6]`
|
||||
///
|
||||
@@ -33,8 +33,8 @@ extension ShareableSet {
|
||||
/// Replace this set with the elements contained in this set or the given
|
||||
/// keys view of a persistent dictionary, but not both.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// a.formSymmetricDifference(b.keys)
|
||||
/// // `a` is now some permutation of `[0, 1, 3, 6]`
|
||||
///
|
||||
@@ -47,7 +47,7 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable
|
||||
public mutating func formSymmetricDifference<Value>(
|
||||
_ other: __owned ShareableDictionary<Element, Value>.Keys
|
||||
_ other: __owned TreeDictionary<Element, Value>.Keys
|
||||
) {
|
||||
self = symmetricDifference(other)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ extension ShareableSet {
|
||||
/// Replace this set with the elements contained in this set or the given
|
||||
/// sequence, but not both.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6, 2, 4, 6]
|
||||
/// a.formSymmetricDifference(b)
|
||||
/// // `a` is now some permutation of `[0, 1, 3, 6]`
|
||||
+7
-7
@@ -9,11 +9,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Adds the elements of the given set to this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// a.formUnion(b)
|
||||
/// // `a` is now some permutation of `[0, 1, 2, 3, 4, 6]`
|
||||
///
|
||||
@@ -37,8 +37,8 @@ extension ShareableSet {
|
||||
/// Adds the elements of the given keys view of a persistent dictionary
|
||||
/// to this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// a.formUnion(b.keys)
|
||||
/// // `a` is now some permutation of `[0, 1, 2, 3, 4, 6]`
|
||||
///
|
||||
@@ -56,14 +56,14 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable
|
||||
public mutating func formUnion<Value>(
|
||||
_ other: __owned ShareableDictionary<Element, Value>.Keys
|
||||
_ other: __owned TreeDictionary<Element, Value>.Keys
|
||||
) {
|
||||
self = union(other)
|
||||
}
|
||||
|
||||
/// Adds the elements of the given sequence to this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6, 0, 2]
|
||||
/// a.formUnion(b)
|
||||
/// // `a` is now some permutation of `[0, 1, 2, 3, 4, 6]`
|
||||
+8
-8
@@ -9,12 +9,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a new set with the elements that are common to both this set and
|
||||
/// the provided other one.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// let c = a.intersection(b)
|
||||
/// // `c` is some permutation of `[2, 4]`
|
||||
///
|
||||
@@ -37,8 +37,8 @@ extension ShareableSet {
|
||||
/// Returns a new set with the elements that are common to both this set and
|
||||
/// the provided keys view of a persistent dictionary.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// let c = a.intersection(b.keys)
|
||||
/// // `c` is some permutation of `[2, 4]`
|
||||
///
|
||||
@@ -55,14 +55,14 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable @inline(__always)
|
||||
public func intersection<Value>(
|
||||
_ other: ShareableDictionary<Element, Value>.Keys
|
||||
_ other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Self {
|
||||
_intersection(other._base._root)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
internal func _intersection<V>(
|
||||
_ other: ShareableHashedCollections._Node<Element, V>
|
||||
_ other: HashTreeCollections._Node<Element, V>
|
||||
) -> Self {
|
||||
guard let r = _root.intersection(.top, other) else { return self }
|
||||
return Self(_new: r)
|
||||
@@ -71,7 +71,7 @@ extension ShareableSet {
|
||||
/// Returns a new set with the elements that are common to both this set and
|
||||
/// the provided sequence.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6]
|
||||
/// let c = a.intersection(b)
|
||||
/// // `c` is some permutation of `[2, 4]`
|
||||
+8
-8
@@ -9,12 +9,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value that indicates whether the set has no members in
|
||||
/// common with the given set.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [5, 6]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [5, 6]
|
||||
/// a.isDisjoint(with: b) // true
|
||||
///
|
||||
/// - Parameter other: Another set.
|
||||
@@ -32,8 +32,8 @@ extension ShareableSet {
|
||||
/// Returns a Boolean value that indicates whether the set has no members in
|
||||
/// common with the given set.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [5, 6]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [5, 6]
|
||||
/// a.isDisjoint(with: b) // true
|
||||
///
|
||||
/// - Parameter other: The keys view of a persistent dictionary.
|
||||
@@ -45,7 +45,7 @@ extension ShareableSet {
|
||||
/// average, if `Element` implements high-quality hashing.
|
||||
@inlinable
|
||||
public func isDisjoint<Value>(
|
||||
with other: ShareableDictionary<Element, Value>.Keys
|
||||
with other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
self._root.isDisjoint(.top, with: other._base._root)
|
||||
}
|
||||
@@ -53,8 +53,8 @@ extension ShareableSet {
|
||||
/// Returns a Boolean value that indicates whether the set has no members in
|
||||
/// common with the given set.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [5, 6]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [5, 6]
|
||||
/// a.isDisjoint(with: b) // true
|
||||
///
|
||||
/// - Parameter other: A finite sequence of elements, some of which may
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
import _CollectionsUtilities
|
||||
|
||||
// FIXME: These are non-standard extensions generalizing ==.
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value indicating whether persistent sets are equal. Two
|
||||
/// persistent sets are considered equal if they contain the same elements,
|
||||
/// but not necessarily in the same order.
|
||||
@@ -46,7 +46,7 @@ extension ShareableSet {
|
||||
/// comparing elements in shared subtrees.
|
||||
@inlinable
|
||||
public func isEqualSet<Value>(
|
||||
to other: ShareableDictionary<Element, Value>.Keys
|
||||
to other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
_root.isEqualSet(to: other._base._root, by: { _, _ in true })
|
||||
}
|
||||
@@ -58,7 +58,7 @@ extension ShareableSet {
|
||||
/// Duplicate items in `other` do not prevent it from comparing equal to
|
||||
/// `self`.
|
||||
///
|
||||
/// let this: ShareableSet = [0, 1, 5, 6]
|
||||
/// let this: TreeSet = [0, 1, 5, 6]
|
||||
/// let that = [5, 5, 0, 1, 1, 6, 5, 0, 1, 6, 6, 5]
|
||||
///
|
||||
/// this.isEqualSet(to: that) // true
|
||||
+8
-8
@@ -11,7 +11,7 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value that indicates whether the set is a strict subset
|
||||
/// of the given set.
|
||||
///
|
||||
@@ -19,8 +19,8 @@ extension ShareableSet {
|
||||
/// also a member of *B* and *B* contains at least one element that is not a
|
||||
/// member of *A*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isStrictSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: Another set.
|
||||
@@ -45,8 +45,8 @@ extension ShareableSet {
|
||||
/// also a member of *B* and *B* contains at least one element that is not a
|
||||
/// member of *A*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isStrictSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: The keys view of a persistent dictionary.
|
||||
@@ -60,7 +60,7 @@ extension ShareableSet {
|
||||
/// e.g. by skipping over parts of the input trees.
|
||||
@inlinable
|
||||
public func isStrictSubset<Value>(
|
||||
of other: ShareableDictionary<Element, Value>.Keys
|
||||
of other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
guard self.count < other.count else { return false }
|
||||
return isSubset(of: other)
|
||||
@@ -73,8 +73,8 @@ extension ShareableSet {
|
||||
/// also a member of *B* and *B* contains at least one element that is not a
|
||||
/// member of *A*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isStrictSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: A sequence of elements, some of whose elements may
|
||||
+8
-8
@@ -11,7 +11,7 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value that indicates whether the set is a strict
|
||||
/// superset of the given set.
|
||||
///
|
||||
@@ -19,8 +19,8 @@ extension ShareableSet {
|
||||
/// also a member of *A* and *A* contains at least one element that is *not*
|
||||
/// a member of *B*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isStrictSuperset(of: b.unordered) // true
|
||||
///
|
||||
/// - Parameter other: Another set.
|
||||
@@ -45,8 +45,8 @@ extension ShareableSet {
|
||||
/// also a member of *B* and *B* contains at least one element that is not a
|
||||
/// member of *A*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isStrictSuperset(of: b.unordered) // true
|
||||
///
|
||||
/// - Parameter other: The keys view of a persistent dictionary.
|
||||
@@ -60,7 +60,7 @@ extension ShareableSet {
|
||||
/// e.g. by skipping over parts of the input trees.
|
||||
@inlinable
|
||||
public func isStrictSuperset<Value>(
|
||||
of other: ShareableDictionary<Element, Value>.Keys
|
||||
of other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
guard self.count > other.count else { return false }
|
||||
return other._base._root.isSubset(.top, of: self._root)
|
||||
@@ -73,8 +73,8 @@ extension ShareableSet {
|
||||
/// also a member of *B* and *B* contains at least one element that is not a
|
||||
/// member of *A*. (Ignoring the order the elements appear in the sets.)
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isStrictSuperset(of: b.unordered) // true
|
||||
///
|
||||
/// - Parameter other: A sequence of elements, some of whose elements may
|
||||
+8
-8
@@ -11,15 +11,15 @@
|
||||
|
||||
import _CollectionsUtilities
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value that indicates whether this set is a subset of
|
||||
/// the given set.
|
||||
///
|
||||
/// Set *A* is a subset of another set *B* if every member of *A* is also a
|
||||
/// member of *B*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: Another set.
|
||||
@@ -41,8 +41,8 @@ extension ShareableSet {
|
||||
/// Set *A* is a subset of another set *B* if every member of *A* is also a
|
||||
/// member of *B*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: The keys view of a persistent dictionary.
|
||||
@@ -55,7 +55,7 @@ extension ShareableSet {
|
||||
/// e.g. by skipping over parts of the input trees.
|
||||
@inlinable
|
||||
public func isSubset<Value>(
|
||||
of other: ShareableDictionary<Element, Value>.Keys
|
||||
of other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
self._root.isSubset(.top, of: other._base._root)
|
||||
}
|
||||
@@ -66,8 +66,8 @@ extension ShareableSet {
|
||||
/// Set *A* is a subset of another set *B* if every member of *A* is also a
|
||||
/// member of *B*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// b.isSubset(of: a) // true
|
||||
///
|
||||
/// - Parameter other: A sequence of elements, some of whose elements may
|
||||
+8
-8
@@ -9,15 +9,15 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a Boolean value that indicates whether this set is a superset of
|
||||
/// the given set.
|
||||
///
|
||||
/// Set *A* is a superset of another set *B* if every member of *B* is also a
|
||||
/// member of *A*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isSuperset(of: b) // true
|
||||
///
|
||||
/// - Parameter other: Another set.
|
||||
@@ -39,8 +39,8 @@ extension ShareableSet {
|
||||
/// Set *A* is a superset of another set *B* if every member of *B* is also a
|
||||
/// member of *A*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isSuperset(of: b) // true
|
||||
///
|
||||
/// - Parameter other: The keys view of a persistent dictionary.
|
||||
@@ -53,7 +53,7 @@ extension ShareableSet {
|
||||
/// e.g. by skipping over parts of the input trees.
|
||||
@inlinable
|
||||
public func isSuperset<Value>(
|
||||
of other: ShareableDictionary<Element, Value>.Keys
|
||||
of other: TreeDictionary<Element, Value>.Keys
|
||||
) -> Bool {
|
||||
other._base._root.isSubset(.top, of: self._root)
|
||||
}
|
||||
@@ -64,8 +64,8 @@ extension ShareableSet {
|
||||
/// Set *A* is a superset of another set *B* if every member of *B* is also a
|
||||
/// member of *A*, ignoring the order they appear in the two sets.
|
||||
///
|
||||
/// let a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [4, 2, 1]
|
||||
/// let a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [4, 2, 1]
|
||||
/// a.isSuperset(of: b) // true
|
||||
///
|
||||
/// - Parameter other: A sequence of elements, some of whose elements may
|
||||
+7
-7
@@ -9,11 +9,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Removes the elements of the given set from this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// a.subtract(b)
|
||||
/// // `a` is now some permutation of `[1, 3]`
|
||||
///
|
||||
@@ -33,8 +33,8 @@ extension ShareableSet {
|
||||
/// Removes the elements of the given keys view of a persistent dictionary
|
||||
/// from this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// a.subtract(b.keys)
|
||||
/// // `a` is now some permutation of `[1, 3]`
|
||||
///
|
||||
@@ -47,7 +47,7 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable
|
||||
public mutating func subtract<Value>(
|
||||
_ other: ShareableDictionary<Element, Value>.Keys
|
||||
_ other: TreeDictionary<Element, Value>.Keys
|
||||
) {
|
||||
// FIXME: Implement in-place reductions
|
||||
self = subtracting(other)
|
||||
@@ -55,7 +55,7 @@ extension ShareableSet {
|
||||
|
||||
/// Removes the elements of the given sequence from this set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6]
|
||||
/// a.subtract(b)
|
||||
/// // `a` is now some permutation of `[1, 3]`
|
||||
+8
-8
@@ -9,12 +9,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension ShareableSet {
|
||||
extension TreeSet {
|
||||
/// Returns a new set containing the elements of this set that do not occur
|
||||
/// in the given other set.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableSet = [0, 2, 4, 6]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeSet = [0, 2, 4, 6]
|
||||
/// let c = a.subtracting(b)
|
||||
/// // `c` is some permutation of `[1, 3]`
|
||||
///
|
||||
@@ -33,8 +33,8 @@ extension ShareableSet {
|
||||
/// Returns a new set containing the elements of this set that do not occur
|
||||
/// in the given keys view of a persistent dictionary.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// let b: ShareableDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b: TreeDictionary = [0: "a", 2: "b", 4: "c", 6: "d"]
|
||||
/// let c = a.subtracting(b.keys)
|
||||
/// // `c` is some permutation of `[1, 3]`
|
||||
///
|
||||
@@ -47,14 +47,14 @@ extension ShareableSet {
|
||||
/// parts of the input trees directly into the result.
|
||||
@inlinable
|
||||
public __consuming func subtracting<V>(
|
||||
_ other: ShareableDictionary<Element, V>.Keys
|
||||
_ other: TreeDictionary<Element, V>.Keys
|
||||
) -> Self {
|
||||
_subtracting(other._base._root)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
internal __consuming func _subtracting<V>(
|
||||
_ other: ShareableHashedCollections._Node<Element, V>
|
||||
_ other: HashTreeCollections._Node<Element, V>
|
||||
) -> Self {
|
||||
guard let r = _root.subtracting(.top, other) else { return self }
|
||||
return Self(_new: r)
|
||||
@@ -63,7 +63,7 @@ extension ShareableSet {
|
||||
/// Returns a new set containing the elements of this set that do not occur
|
||||
/// in the given sequence.
|
||||
///
|
||||
/// var a: ShareableSet = [1, 2, 3, 4]
|
||||
/// var a: TreeSet = [1, 2, 3, 4]
|
||||
/// let b = [0, 2, 4, 6]
|
||||
/// let c = a.subtracting(b)
|
||||
/// // `c` is some permutation of `[1, 3]`
|
||||
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user