Skip to content

perf(scan): type-check every app's config package in one load - #54

Merged
harrisoncramer merged 1 commit into
mainfrom
perf/batch-config-scan
Sep 1, 2026
Merged

harrisoncramer merged 1 commit into
mainfrom
perf/batch-config-scan

Conversation

@harrisoncramer

@harrisoncramer harrisoncramer commented Sep 1, 2026 •

Copy link
Copy Markdown
Owner

Lint spends nearly all of its time in the config scan, and almost none of that time is really about the config. Scanning a package with go/packages in NeedTypes mode makes the Go toolchain build export data for everything the package imports, and an app config that embeds a shared struct drags in that struct's whole world.

Lint now asks the scanner to type-check every app's config package in one packages.Load before it fans out, and Scanner remembers what it type-checked.

One caveat for callers: the batched load only pays off when the directories resolve together. A repo of separate modules needs a go.work for this to do anything, and a consumer that sets GOWORK=off will silently get the old per-directory behaviour.

Scanner caches the Config struct it type-checks, and Lint prepares every
app's config package in a single packages.Load before it fans out. Apps
share nearly all of their dependency graph, so loading them together
costs about what loading one of them costs.
@harrisoncramer
harrisoncramer merged commit cbabdd9 into main Sep 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant