Skip to content

0.8.0

Compare
Choose a tag to compare
@hassila hassila released this 16 Feb 09:54
· 188 commits to main since this release
81bd87b

What's Changed

  • feat: Add Configuration type to allow sharing of common configurations between benchmarks by @hassila in #59

Refactored configuration into a separate type and simplified the benchmark init signature accordingly.

This allows for sharing of configurations between benchmarks more easily, but is a source break.

It's trivial to change existing options for a benchmark though, e.g.

    Benchmark("Memory transient allocations + 1 large leak",
              metrics: BenchmarkMetric.memory,
              throughputScalingFactor: .kilo) { benchmark in
        performAllocations(count: benchmark.throughputScalingFactor.rawValue, size: 11 * 1024 * 1024)
        performAllocations(count: 1, size: 32 * 1024 * 1024, shouldFree: false)
    }

becomes

    Benchmark("Memory transient allocations + 1 large leak",
         configuration: .init(metrics: BenchmarkMetric.memory,
                                         throughputScalingFactor: .kilo)) { benchmark in
        performAllocations(count: benchmark.throughputScalingFactor.rawValue, size: 11 * 1024 * 1024)
        performAllocations(count: 1, size: 32 * 1024 * 1024, shouldFree: false)
    }

and

    Benchmark.defaultDesiredDuration = .milliseconds(10)
    Benchmark.defaultDesiredIterations = .giga(1)

becomes analogous

    Benchmark.defaultConfiguration = .init(desiredDuration: .milliseconds(10),
                                           desiredIterations: .giga(1))

or (both works)

Benchmark.defaultConfiguration.desiredDuration = .milliseconds(10)
Benchmark.defaultConfiguration.desiredIterations = .giga(1)

Gives nicer API and reusability of settings among targets.

Full Changelog: 0.7.0...0.8.0