-
Notifications
You must be signed in to change notification settings - Fork 430
Add benchmarks for Metadata collection #1691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small comments, looks good otherwise. Presumably we need to add a baseline for these too.
Performance/Benchmarks/Benchmarks/GRPCSwiftBenchmark/Benchmarks.swift
Outdated
Show resolved
Hide resolved
Performance/Benchmarks/Benchmarks/GRPCSwiftBenchmark/Benchmarks.swift
Outdated
Show resolved
Hide resolved
Benchmark("Metadata - Add binary") { benchmark in | ||
let value: [UInt8] = [1, 2, 3] | ||
benchmark.startMeasurement() | ||
for _ in benchmark.scaledIterations { | ||
var metadata = Metadata() | ||
for i in 0..<1000 { | ||
metadata.addBinary(value, forKey: "\(i)") | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark.init has an overload with a trailing setup closure which is executed once and can return some setup data: https://swiftpackageindex.com/ordo-one/package-benchmark/1.11.2/documentation/benchmark/benchmark/init(_:configuration:closure:setup:teardown:)-8kbjd
e277bf2
to
9a5e91e
Compare
9a5e91e
to
583df4b
Compare
} | ||
} | ||
|
||
Benchmark("Metadata_Remove_values_for_key") { benchmark in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we only need underscores in the filename:
- https://github.com/apple/swift-certificates/blob/main/Benchmarks/Benchmarks/CertificatesBenchmark/Benchmarks.swift
- https://github.com/apple/swift-certificates/tree/main/Benchmarks/Thresholds/5.9
Can we remove them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I had originally (files with underscores, benchmark names with spaces) but the check against the thresholds would always pass even when it shouldn't - I could only make it fail once I started using underscores in the names too.
Motivation
This PR adds benchmarks (perf tests) for the Metadata collection introduced in #1683
Modifications
Benchmarks added
Result
Benchmarks for Metadata collection are now present.