[Capsule] Add persistent dictionary index benchmarks

This commit is contained in:
Michael Steindorfer committed 2022-09-02 09:00:52 +02:00
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",
+20
View File
@@ -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:)",
]
},
]
},
]