Repository navigation
Conversation
v1.0.0-beta.24 is the first release with File.extract's include and exclude patterns, which unpacking a module without its tests needs. The regenerated client also brings withExec's transparentHugePages, and the Go SDK's one-request dispatch: a function call's name, parent and arguments are read in one request instead of one per value. Signed-off-by: Erik Sipsma <[email protected]>
The compiler's heap grows into fresh memory, and on a host set to "always" huge pages save a cold build most of its page faults (2.8 s of dagger's CLI first build on a 16-core Graviton4). Elsewhere it changes nothing. Signed-off-by: Erik Sipsma <[email protected]>
Each build read the workspace from the client twice, one read after the other: once for the scan, with every Go file and go.mod, and again for the module's source, with the patterns the scan worked out. Both patterns match at any depth, so each read walked the client's whole tree. The scan now reads every file a Go build can need whose name alone picks it out (goSource), and a module's source reuses that read, which the engine answers from its session cache. The source reads again only the patterns goSource doesn't cover, such as embedded files, and those name the directories they are in, so that read skips the rest of the tree. Signed-off-by: Erik Sipsma <[email protected]>
A "!" pattern takes back files the patterns before it selected. Split across the shared Go source read and the read of the rest, it applied only to the rest, so a Go file it excluded stayed in the source. A source whose patterns hold one is read in one read of the whole list, in order, as before. Signed-off-by: Erik Sipsma <[email protected]>
Dagger cleans a pattern's path before it looks for a leading "!", so "./!a.go" excludes a.go, but it doesn't start with one. A source whose patterns hold a "!" anywhere is now read in one read, as before. Signed-off-by: Erik Sipsma <[email protected]>
A build of a dependency never reads its test files or its testdata directories, which the go command ignores, and in some modules they are most of the files. Each module is now extracted without them, through File.extract's exclude patterns, which leave those entries of the zip undecompressed. For dagger's CLI that is about half the files and 0.35 GB of the 1.26 GB unpacked. What the build plan does read from them is put back: a dependency's tests that go test -c compiles, and files a package embeds from testdata. A module none of those come from, nearly every one, extracts the same in every build, so its packages' cache keys stay shared across projects. Signed-off-by: Erik Sipsma <[email protected]>
A package with C or assembly reads its whole module, which its includes can reach anywhere in, testdata included, without the plan naming the file. Such a module was still extracted without its tests and testdata, so an include from testdata failed. It is now extracted whole, exactly as before the exclusions. A directory read whole, where cgo runs, is put back whole too. The exclusions now match only under the module's own directory in the zip, so a module path with a "testdata" element no longer matches them, and a file in a directory named like a test file is put back when the build reads it. Signed-off-by: Erik Sipsma <[email protected]>
…he scan go build reads a local replace's target only for a module the build needs. A replace of a module that go.mod doesn't list, and that nothing else in the build needs, is unused, and go build never looks for its target. The scan failed on any local replace whose target wasn't in the workspace, so a module carrying such a replace built with go build but not with dagger/go. dagger/dagger's own modules have one: release, php-client-dev and python-client-dev replace github.com/dagger/dagger with the repository root, and require nothing from it. The scan now leaves an absent target of an unlisted module to go: if a dependency's go.mod does need the module, go reports the missing target at build time, as it does without dagger/go. A replace of a module go.mod requires, with an absent target, still fails the scan with the line that declares it, and a target present in the workspace is still followed. Signed-off-by: Erik Sipsma <[email protected]>
Contributor
Author
|
Folded into #95, which now carries this PR's commits unchanged alongside the rest of the per-package build. |
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.
Three changes that make building Go with this module faster, combined into one PR because they all land with gobuild's move to engine v1.0.0-beta.24, and one fix to the workspace scan. Each keeps its own commits.
What users get. Building dagger's CLI with the go module, on 16-core arm64 machines. Each change was measured on its own on an earlier build, not together and not again on this branch:
Regenerating gobuild's client also brings the Go SDK's one-request dispatch: a function call's name, parent and arguments are read in one request instead of one per value. That isn't measured on its own.
gobuild now needs engine v1.0.0-beta.24. It declares
engineVersion = "v1.0.0-beta.24"instead of v1.0.0-beta.22, because that's the first release withFile.extract's include and exclude patterns.The first build after upgrading recompiles everything once. Unpacking without tests changes what each module's directory holds, and with it the cache keys of the packages that read it.
An unlisted local
replaceno longer fails the build. A module whose go.mod carries a localreplaceof a module it doesn't require, with a target that isn't in the workspace, built withgo buildbut failed dagger/go's workspace scan ("no Go module found for local replace target").go buildreads a replacement only for a module the build needs, so such a replace is usually unused. dagger/dagger's ownrelease,php-client-devandpython-client-devmodules carry one. The scan now leaves an absent target of an unlisted module to go, which reports it at build time if a dependency does need the module. A replace of a module go.mod requires, with an absent target, still fails the scan with the line that declares it.One source read per build
Each build read the workspace from the client twice, one read after the other: once for the scan and again for the module's source. Both read patterns that match at any depth, so each walked the client's whole tree.
The scan now reads every file a Go build can need whose name alone picks it out, and a module's source reuses that read, which the engine answers from its session cache. The source reads again only the patterns that read doesn't cover, such as embedded files. Those name the directories they are in, so that read skips the rest of the tree.
A
!pattern takes back what the patterns before it selected, which only one read of the whole list in order does. So a source whose patterns hold a!anywhere is read in one read, as before. The e2e module's scan check covers both!a.goand./!a.go.Huge pages for package builds
A package's compile and link set
transparentHugePages, since the compiler's heap grows into fresh memory. The setting isn't part of an exec's cache key.Unpacking without tests and testdata
A build of a dependency never reads its test files or its testdata directories, which the go command ignores, and in some modules they are most of the files. Each module is now extracted through
File.extract's exclude patterns, which leave those entries of the zip undecompressed.What the build plan does read from them is put back: a dependency's tests that
go test -ccompiles, files a package embeds from testdata, and directories where cgo runs. A module read whole for its C or assembly, whose includes can reach any of its files, is extracted whole, as before. Any other module extracts the same in every build, so its packages' cache keys stay shared across projects.TestExcludeUnreadcovers the patterns, and runs ingobuildCheck.Merging with #95
This and #95 both change gobuild's client. Git merges everything else cleanly, but
gobuild/dagger.gen.goconflicts, and whichever merges second regenerates it.