diff --git a/benchmarks/Benchmarks/CertificatesBenchmarks/Benchmarks.swift b/benchmarks/Benchmarks/CertificatesBenchmarks/Benchmarks.swift index e26ee64..0cecc4d 100644 --- a/benchmarks/Benchmarks/CertificatesBenchmarks/Benchmarks.swift +++ b/benchmarks/Benchmarks/CertificatesBenchmarks/Benchmarks.swift @@ -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() } } } diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 58105af..95c312c 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -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