mirror of
https://github.com/apple/swift-collections
synced 2026-11-30 05:18:44 +00:00
[Capsule] Add persistent dictionary index benchmarks
This commit is contained in:
1 parent
810f22d976
commit
afcd915044
2 files changed
+43
-23
No files matched your search
@@ -276,29 +276,29 @@ extension Benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
// self.add(
|
||||
// title: "PersistentDictionary<Int, Int> successful index(forKey:)",
|
||||
// input: ([Int], [Int]).self
|
||||
// ) { input, lookups in
|
||||
// let d = PersistentDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
// return { timer in
|
||||
// for i in lookups {
|
||||
// precondition(d.index(forKey: i) != nil)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// self.add(
|
||||
// title: "PersistentDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
// input: ([Int], [Int]).self
|
||||
// ) { input, lookups in
|
||||
// let d = PersistentDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
// return { timer in
|
||||
// for i in lookups {
|
||||
// precondition(d.index(forKey: lookups.count + i) == nil)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
self.add(
|
||||
title: "PersistentDictionary<Int, Int> successful index(forKey:)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = PersistentDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d.index(forKey: i) != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "PersistentDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
input: ([Int], [Int]).self
|
||||
) { input, lookups in
|
||||
let d = PersistentDictionary(uniqueKeysWithValues: input.lazy.map { ($0, 2 * $0) })
|
||||
return { timer in
|
||||
for i in lookups {
|
||||
precondition(d.index(forKey: lookups.count + i) == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.add(
|
||||
title: "PersistentDictionary<Int, Int> updateValue(_:forKey:), existing",
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
"PersistentDictionary<Int, Int> updateValue(_:forKey:), insert",
|
||||
"PersistentDictionary<Int, Int> random removals (existing keys)",
|
||||
"PersistentDictionary<Int, Int> random removals (missing keys)",
|
||||
"PersistentDictionary<Int, Int> successful index(forKey:)",
|
||||
"PersistentDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -89,6 +91,24 @@
|
||||
"OrderedDictionary<Int, Int> subscript, remove existing",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "index(forKey:), successful index(forKey:)",
|
||||
"tasks": [
|
||||
"PersistentDictionary<Int, Int> successful index(forKey:)",
|
||||
"Dictionary<Int, Int> successful index(forKey:)",
|
||||
"OrderedDictionary<Int, Int> successful index(forKey:)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chart",
|
||||
"title": "index(forKey:), unsuccessful index(forKey:)",
|
||||
"tasks": [
|
||||
"PersistentDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"Dictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
"OrderedDictionary<Int, Int> unsuccessful index(forKey:)",
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user