test(integration): add GetChangedTargets benchmarks#204
Open
yushan8 wants to merge 2 commits into
Open
Conversation
Add a `make benchmark` target that measures GetChangedTargets latency against three fixed, checked-in commit pairs of increasing diff size (small/medium/large). This is measurement-only: it has no pass/fail thresholds, is not part of `make test` / `make test-integration`, and is never invoked from CI, so a slow run can never fail the build. - Widen repoRemote/startServer/newClient/getChangedTargets in integration_test.go from *testing.T to testing.TB so the existing integration test harness can be reused from Benchmark* functions. - Add integration/benchmark_test.go with three benchmarks pinned to fixed commit SHAs in this repo's own history. - Add benchmark_test.go to the integration_test BUILD.bazel target via `make gazelle`. - Add the `make benchmark` target, which runs the same bazel go_test binary with -test.run=^$ -test.bench=. so only benchmarks execute. Test Plan: - make gazelle (confirmed BUILD.bazel picked up the new file) - make test-integration (existing tests still pass unchanged) - make benchmark (all three benchmarks run and report ns/op, exits 0)
ns/op is hard to eyeball at these durations (calls take seconds, not nanoseconds). Add a sec/op custom metric via b.ReportMetric alongside the built-in ns/op, computed from b.Elapsed() so it reflects the same timer window (post-ResetTimer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
make benchmarktarget that measuresGetChangedTargetslatency against three fixed, checked-in commit pairs of increasing diff size (small/medium/large).make test/make test-integration, and never invoked from CI.repoRemote/startServer/newClient/getChangedTargetsinintegration_test.gofrom*testing.Ttotesting.TBso the existing integration harness can be reused fromBenchmark*functions.Test plan
make gazelle—integration/BUILD.bazelpicked up the newbenchmark_test.gomake test-integration— existing integration tests still pass unchangedmake benchmark— all three benchmarks run and reportns/op, exits 0