creates the Benchmarks/MyBenchmark/MyBenchmark.swift source file with the boilerplate:
import Benchmark
import Foundation
let benchmarks = {
Benchmark.defaultConfiguration = .init(scalingFactor: .kilo)
Benchmark("SomeBenchmark") { benchmark in
for _ in benchmark.scaledIterations {
blackHole(Date()) // replace this line with your own benchmark
}
}
}
generates this to standard out (preferably so we can pipe it to pbcopy) :
Something like
swift package benchmark init MyBenchmark
creates the
Benchmarks/MyBenchmark
directorycreates the
Benchmarks/MyBenchmark/MyBenchmark.swift
source file with the boilerplate:pbcopy
) :Which can then just be copy-pasted into Package.swift and we're ready to go