perf(gnovm): parallelize test suites and add gno test -jobs#5811
Draft
thehowl wants to merge 2 commits into
Draft
perf(gnovm): parallelize test suites and add gno test -jobs#5811thehowl wants to merge 2 commits into
thehowl wants to merge 2 commits into
Conversation
TestFiles ran its 2339 non-long filetests sequentially on a single goroutine; they now run as parallel subtests, drawing a TestOptions (with its store) from a GOMAXPROCS-sized pool so loaded packages are still reused across tests. -update-golden-tests keeps the fully sequential single-store behavior. TestStdlibs ran most stdlib suites sequentially on a shared store in the parent test body, which also delayed the parallel heavy suites (bytes, strconv, ...) until the walk finished, since parallel subtests only start once the parent body returns. Every stdlib package now runs as a parallel subtest with its own store. gnoBuiltinsCache was lazily populated from TypeCheckMemPackage without synchronization; with type-checks now running concurrently from the start, that latent race becomes load-bearing. The cache is now built eagerly at package init and read-only afterwards.
gno test runs packages sequentially on a single-threaded VM; on the gnovm stdlibs CI job this is ~455s of test time on one core of a 4-vCPU runner (bytes 174s, strconv 86s, math/overflow 60s, ...). -jobs N (default 1: behavior unchanged) tests up to N packages in parallel. Each worker owns a TestOptions/store, reused across the packages it runs; per-package output is buffered and printed in package order as results complete, so runs remain readable and deterministic. Incompatible with the interactive -debug mode. The CI gno-test step (gnovm stdlibs and examples jobs) now passes -jobs 4 to match the runner's 4 vCPUs.
This was referenced Jun 11, 2026
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):No automated checks match this pull request. ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
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.
Note
Part 1 of 6 of the gnovm performance stack (split from #5800), to be merged in order:
Each PR is based on the previous one's branch; this one diffs against master. Together:
ci / gnovm~14m → 6m18s;pkg/gnolangtest time −64%; VM heap allocations −84% on the heaviest suite.Summary
ci / gnovmtook a stable ~14 minutes, withpkg/gnolangalone at ~708–722s ofmain / testand thestdlibs / testjob fully sequential at 8m33s. This PR restructures the test suites for parallelism — no test content changes — and givesgno testpackage-level parallelism.TestFiles: the 2339 non-long filetests ran sequentially on one goroutine; they now run as parallel subtests drawing aTestOptions(store) from aGOMAXPROCS-sized pool, so stores and their loaded stdlib packages are still reused, just split N ways.-update-golden-testskeeps the fully sequential single-store behavior (deterministic walk-order writes).TestStdlibs: the sequential shared-store walk ran in the parent test body, which also delayed the already-parallel heavy suites (Go only starts parallel subtests after the parent body returns — math/overflow alone blocked them for ~60s). Every stdlib package now runs as a parallel subtest with its own store, removing the hardcoded special-case lists.gnoBuiltinsCachewas a package-level map lazily populated fromTypeCheckMemPackage— a latent data race that becomes load-bearing with concurrent type-checks; it is now built eagerly at init and read-only afterwards.gno test -jobs N(default 1 = behavior unchanged): tests up to N packages in parallel, each worker owning a store/typecheck cache reused across the packages it runs; per-package output is buffered and printed in package order as results complete (out/err kept on their original streams).-failfaststops scheduling new packages; in-flight ones finish. Incompatible with the interactive-debugmode. The CIgno teststep (gnovm stdlibs and examples jobs) passes-jobs 4to match the 4-vCPU runners.Measurements
stdlibs / testjobgno-checks / testjobgno test gnovm/stdlibs/..., 4 pinned cores-jobs 4)go test ./pkg/gnolang/long mode, 16 coresmain / testitself barely moves from parallelization alone (on a 4-vCPU runner it is bound by total CPU work —go test -palready packed the cores); the rest of the stack attacks the work itself. A measured caveat that shaped the design: N concurrent VMs in one process slow each other down well beyond core-sharing (GC assist/memory pressure; per-package wall inflates 2–3x under-jobs 4), which is why-jobsdefaults to 1 and why parallelism only pays where the baseline wasted cores.Verification: filetest suite pass/fail set unchanged,
gno testoutput equivalence checked for-jobs 1vs-jobs 4(same result lines, same order), examples (220 packages) and cmd/gno suites pass, txtar suite passes.