Creating and Comparing Benchmark Baselines
Benchmark supports storing, and comparing, benchmark baselines as you develop.
CreatingAndComparingBaselines.mdOverview
While developing locally, you can set benchmark baselines, compare a baseline against a benchmark run, or compare two different baselines.
Creating a Baseline
Typical workflow for a developer who wants to track performance metrics on the local machine while during performance work, would be to store one or more baselines.
To create or update a baseline named alpha
, run the following command:
swift package --allow-writing-to-package-directory benchmark baseline update alpha
Comparing against a Baseline
As you are making performance updates to your code, compare the current state of your code against a recorded baseline with the following command:
swift package benchmark baseline compare alpha
If you have stored multiple baselines (for example for different approaches to solving a given performance issue), you can easily compare the two approaches by using named baselines for each and then compare them. The following command compares a baseline named alpha
against baseline named beta
:
swift package benchmark baseline compare alpha beta
Comparing a test run against static thresholds
The following will run all benchmarks and compare them against a previously saved static threshold.
swift package benchmark thresholds check
See also
Writing Benchmarks
Create benchmark suites to run and measure your benchmarks.
Read MoreMetrics and Thresholds
Benchmarks supports a wide range of benchmark metrics and also allows you to create custom benchmark metrics.
Read MoreRunning Benchmarks
Use the SwiftPM package plugin
Read Morebenchmark
to run your benchmarksChecking Benchmark Results Using Continuous Integration
Benchmark was written with continuous integration in mind, and allows you to set up comparisons to validate builds.
Read MoreExporting Benchmark Results
Export Benchmarks into other formats to analyze or visualize the data.
Read More