Skip to content

Commit

Permalink
Remove an unnecessary allocation from the trie router benchmark (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis authored May 13, 2024
1 parent 5a6a097 commit 05a4590
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Benchmarks/Benchmarks/Router/TrieRouterBenchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func trieRouterBenchmarks() {
benchmark.startMeasurement()

for _ in benchmark.scaledIterations {
blackHole(testValues.map { trie.resolve($0) })
for testValue in testValues {
blackHole(trie.resolve(testValue))
}
}
} setup: {
let trieBuilder = RouterPathTrieBuilder<String>()
Expand All @@ -53,7 +55,9 @@ func trieRouterBenchmarks() {
benchmark.startMeasurement()

for _ in benchmark.scaledIterations {
blackHole(testValues.map { trie2.resolve($0) })
for testValue in testValues {
blackHole(trie2.resolve(testValue))
}
}
} setup: {
let trieBuilder = RouterPathTrieBuilder<String>()
Expand All @@ -73,7 +77,9 @@ func trieRouterBenchmarks() {
benchmark.startMeasurement()

for _ in benchmark.scaledIterations {
blackHole(testValues.map { trie3.resolve($0) })
for testValue in testValues {
blackHole(trie3.resolve(testValue))
}
}
} setup: {
let trieBuilder = RouterPathTrieBuilder<String>()
Expand Down

0 comments on commit 05a4590

Please sign in to comment.