Repository navigation
Conversation
grouville
force-pushed
the
perf/review-package-test-discovery
branch
from
October 19, 2026 23:46
4208c62 to
bc0d99e
Compare
This was referenced Oct 21, 2026
grouville
force-pushed
the
perf/review-package-test-discovery
branch
from
October 21, 2026 19:47
bc0d99e to
af01bbf
Compare
This was referenced Oct 22, 2026
Listing a package's tests reads matching lines from the whole Go module, then keeps only that package's files. Listing every package repeats the processing of those module-wide results. Search only the package's direct test files. Keep the existing matcher, filename order and directory traversal, including literal filenames and symlink handling. The files-only search used to discover package paths stays module-wide. Cover Unicode names, bracket characters in filenames, mounted workspaces, and files and packages added through Dagger. Keep the existing collection checks for nested modules, ordering and selected test execution. Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
force-pushed
the
perf/review-package-test-discovery
branch
from
October 23, 2026 07:55
af01bbf to
b3631f1
Compare
Contributor
|
Closing in favor of #81 |
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.
Listing a package's tests currently reads matching functions across its whole Go module, then keeps that package's files. Listing every package repeats that work. In a 16-package fixture, the same 129 matching lines are read 16 times.
Search only each package's direct test files instead. The module-wide search that discovers package paths stays as it is. This keeps
Workspace.search, the test matcher, filename ordering and directory traversal. The production change is 12 lines, with no new cache or public API.This is part of the work to improve Go collection listing. The branch is rebased on Go main
c25c457, including #74 and #76, and the filename, overlay and selected-test regression checks pass with that version. The timings below use the earlier pinned versions; a full-listing speedup against #74/#76 is not established yet.After the discovery changes in #72 and #73, on engine main e7f0bd65, the complete 16-package listing improves from 6.65 to 3.96 seconds across four pairs.
I also checked whether the change still helps with Erik's newer parser. For the table below, both versions use engine main 14c1942e with the parser update from vito/dang#204. That parser has merged upstream but is not yet pinned by the engine. The module baseline is Go main bf45651; only this PR differs between the two columns.
dagger check --module go --check test --list --allEach row is the median of four pairs, alternating which version runs first. These are complete commands, including session cleanup, after an ordinary-source edit and adding a unique test. Each starts a fresh CLI on an already running engine, after a successful untimed preparation. All 32 measured commands returned the expected rows in order and cleaned up successfully. No outside Go builds overlapped them.
For 64 packages, engine CPU use falls from 264.47 to 66.08 CPU-seconds, and cumulative allocation from 39.78 to 10.35 GB. For 16 packages, allocation falls from 4.78 to 2.83 GB. These are bytes allocated over the command, not peak memory usage.
There is little to save with one package. The controls are about 50 ms and 128 ms slower in this sample, with allocation changing by less than 1%. Those costs remain in the results; this PR is useful when listing tests across many packages.
Separate wcprof captures of the 16-package case on the original engine baseline show matched-line reads falling from 2,064 to 129, while workspace searches stay at 18 in both versions. This removes repeated processing of other packages' matches without skipping discovery.
The runs use normal telemetry and GC, profiling off, Go 1.26.6, eight engine CPUs and a 40 GiB memory limit on a shared Linux host. Both sides use the same CLI, including a separate local stdout-buffer fix. The table has no other unmerged engine or Go performance changes.
The full dagger/dagger workload selects the root Go module at
ff0b029a, with 4,398 existing tests plus the added test. The table covers the smaller fixtures, not a full-repository speedup. Full commands that time out, return incomplete output or fail cleanup are excluded.The filename, overlay and existing collection checks pass. They cover Unicode names, bracket characters in filenames, mounted workspaces, added files and packages, nested modules, ordering and selected test execution. The SDK race checks also pass with the newer parser.