perf(internal/civisibility): cache SetTestFunc source metadata#4691
Conversation
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 681734c | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01a6fd0071
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-04-24 15:51:36 Comparing candidate commit 681734c in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 271 metrics, 7 unstable metrics.
|
62de3fa
into
main
What does this PR do?
Caches the source metadata used by
(*tslvTest).SetTestFuncso each source file is parsed once per process instead of being reparsed on every call.The change keeps the existing behavior intact while moving the AST work into a per-file cache:
unskippablesemantics, impacted-tests inputs, code-owner lookup, and debug log messagesunskippable, negative parse caching, concurrent cache access, and declarations without bodiesMotivation
Profiling
internal/civisibility/integrations/gotestingconsistently showed repeatedgo/parser.ParseFilework insideSetTestFuncas the main internal hotspot. This removes that repeated parsing without changing the observable behavior of the integration.Validation run for this change:
go test ./internal/civisibility/integrations/...go test ./internal/civisibility/integrations/gotesting/...go test ./internal/civisibility/...TestFlakyTestRetries=1 go test -cpuprofile=... -memprofile=... .ininternal/civisibility/integrations/gotesting, confirminggo/parser.ParseFiledrops from a repeated hotspot to one-time metadata loadingReviewer's Checklist
make lintlocally.make testlocally.make generatelocally.make fix-moduleslocally.Unsure? Have a question? Request a review!