mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
Add simple benchmarks measuring instructions count and allocations when logging with various log levels. ### Motivation: Establish the baseline and have automated checks before approaching performance improvements. ### Modifications: - Dependency on https://github.com/ordo-one/package-benchmark added - A new `Benchmarks` sub-package is added - CI workflows now run benchmarks ### Result: - CI workflows are running benchmarks on Linux and macOS - Thresholds are recorded and verified only on macOS An example of a benchmark failing with a **better** results than expected: https://github.com/apple/swift-log/actions/runs/19540944353/job/55950355442 An example of a benchmark failing with a **worse** results than expected: https://github.com/apple/swift-log/actions/runs/19569105729/job/56038101552
31 lines
838 B
Swift
31 lines
838 B
Swift
// swift-tools-version: 6.0
|
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
|
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "Benchmarks",
|
|
platforms: [
|
|
.macOS(.v13)
|
|
],
|
|
dependencies: [
|
|
.package(path: "../"),
|
|
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.6"),
|
|
]
|
|
)
|
|
|
|
// Benchmark of SwiftLogBenchmarks
|
|
package.targets += [
|
|
.executableTarget(
|
|
name: "SwiftLogBenchmarks",
|
|
dependencies: [
|
|
.product(name: "Benchmark", package: "package-benchmark"),
|
|
.product(name: "Logging", package: "swift-log"),
|
|
],
|
|
path: "Benchmarks/SwiftLogBenchmarks",
|
|
plugins: [
|
|
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
|
|
]
|
|
)
|
|
]
|