mirror of
https://github.com/apple/swift-certificates
synced 2026-11-28 04:54:21 +00:00
use automated threshold import
This commit is contained in:
1 parent
9d029e018c
commit
5a038c7a4a
2 files changed
+20
-46
No files matched your search
@@ -16,61 +16,35 @@ import Benchmark
|
||||
import Sources
|
||||
import Foundation
|
||||
|
||||
func thresholds(for benchmarkName: String) -> [BenchmarkMetric : BenchmarkThresholds]? {
|
||||
// https://forums.swift.org/t/pitch-introduce-module-to-get-the-current-module-name/45806/8
|
||||
let moduleName = String("\(#fileID)".prefix(while: { $0 != "/" }))
|
||||
|
||||
return BenchmarkThresholds.makeBenchmarkThresholds(
|
||||
path: FileManager.default.currentDirectoryPath,
|
||||
moduleName: moduleName,
|
||||
benchmarkName: benchmarkName
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
let benchmarks = {
|
||||
Benchmark.defaultConfiguration = .init(
|
||||
metrics: [.mallocCountTotal, .syscalls, .retainCount],
|
||||
warmupIterations: 1
|
||||
)
|
||||
|
||||
do {
|
||||
let testName = "Verifier"
|
||||
Benchmark(testName, configuration: .init(
|
||||
metrics: [.mallocCountTotal, .syscalls],
|
||||
thresholds: thresholds(for: testName))
|
||||
) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
await verifier()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let runParseWebPKIRoots = parseWebPKIRoots()
|
||||
let testName = "Parse WebPKI Roots"
|
||||
Benchmark(testName, configuration: .init(thresholds: thresholds(for: testName))) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
runParseWebPKIRoots()
|
||||
}
|
||||
}
|
||||
}
|
||||
do {
|
||||
let testName = "TinyArray non-allocating functions"
|
||||
Benchmark(testName, configuration: .init(thresholds: thresholds(for: testName))) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
tinyArrayNonAllocationFunctions()
|
||||
}
|
||||
Benchmark("Verifier", configuration: .init(metrics: [.mallocCountTotal, .syscalls])) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
await verifier()
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let testName = "TinyArray.append(_:)"
|
||||
Benchmark(testName, configuration: .init(thresholds: thresholds(for: testName))) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
tinyArrayAppend()
|
||||
}
|
||||
let runParseWebPKIRoots = parseWebPKIRoots()
|
||||
Benchmark("Parse WebPKI Roots") { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
runParseWebPKIRoots()
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark("TinyArray non-allocating functions") { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
tinyArrayNonAllocationFunctions()
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark("TinyArray.append(_:)") { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
tinyArrayAppend()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ services:
|
||||
|
||||
test:
|
||||
<<: *common
|
||||
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-} && cd benchmarks && cp -f ./Thresholds/$${SWIFT_VERSION-}/* ./Thresholds && swift package benchmark baseline check --check-absolute"
|
||||
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-} && cd benchmarks && swift package benchmark baseline check --check-absolute-path Thresholds/$${SWIFT_VERSION-}/"
|
||||
|
||||
update-benchmark-baseline:
|
||||
<<: *common
|
||||
|
||||
Reference in new issue
Block a user