Repository navigation
Fresh dagger check -l of dagger/dagger in under 5 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planning - #15080
Merged
Conversation
sipsma
force-pushed
the
sipsma/faster-unchanged-reruns
branch
from
November 5, 2026 09:30
2cc937f to
1791150
Compare
dagger check -l and check reruns on a Git workspace
dagger check -l and check reruns on a Git workspacedagger check -l and check reruns on a Git workspace, and module calls that follow the modules they serve
dagger check -l and check reruns on a Git workspace, and module calls that follow the modules they servedagger check -l and check reruns on a Git workspace, and Git module keys that cover a workspace's uncommitted edits
sipsma
force-pushed
the
sipsma/faster-unchanged-reruns
branch
3 times, most recently
from
November 5, 2026 20:14
e2945a3 to
f2dc4f3
Compare
dagger check -l and check reruns on a Git workspace, and Git module keys that cover a workspace's uncommitted editsdagger check -l of dagger/dagger in 6.5 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planning
sipsma
force-pushed
the
sipsma/faster-unchanged-reruns
branch
from
November 5, 2026 20:16
f2dc4f3 to
ace14d5
Compare
This was referenced Nov 5, 2026
grouville
approved these changes
Nov 5, 2026
dagger check -l of dagger/dagger in 6.5 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planningdagger check -l of dagger/dagger in 6 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planning
sipsma
force-pushed
the
sipsma/faster-unchanged-reruns
branch
from
November 5, 2026 21:14
2a9ece0 to
874f572
Compare
…lock waits An install's prefetcher bookkeeping now takes the part prefetcher's lock through wcprof.Lock, as dagql.partPrefetcher.mu, and the snapshot manager's steps on its path take the manager's lock the same way, as snapshots.snapshotManager.mu, which the owner-lease calls already record: a chain import's index lookups, its layer reuse and record, GetBySnapshotID, New and a mutable snapshot's Commit. A wait under contention is then the install's lock wait, not its own time. The index lookups take the import's context to record it. Signed-off-by: Erik Sipsma <[email protected]>
Recording a layer's blob as its snapshot's content, committing an overlay layer onto its parent and releasing an immutable ref all take the snapshot manager's lock on an install's path; they now record a blocked acquisition as a lock wait of the caller's op, as the other install sites do. Signed-off-by: Erik Sipsma <[email protected]>
The lock wait tests released the lock a fixed 50 ms after taking it, so work slow to reach the lock recorded a shorter wait than they required. They now release it a fixed time after the work's goroutine is seen blocked in wcprof.Lock, which bounds the recorded wait from below. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
An install releases its mutable snapshots when applying a layer fails or is cancelled, under the snapshot manager's lock. Signed-off-by: Erik Sipsma <[email protected]>
…lock waits Signed-off-by: Erik Sipsma <[email protected]>
On a fresh engine after an edit, lazy evaluations under results found in the Cloud spend 30-50 s of the check's critical path in their own time, over about 1,350 evaluations of 10-25 ms each, and most of it is recorded as nothing: no step, no wait. The set-up and wind-down around an evaluation's body are now steps of its op: taking the row's ownership, starting the body's goroutine, the operation lease, retiring the attempt, and the span's content digest, cache state and end. The graph lock's acquisitions on the part machinery's paths, and the row's lazy mutex as the attempt retires, record their waits as the part demand's sites already do. Signed-off-by: Erik Sipsma <[email protected]>
…them A step's own context now carries the work inside it, so a graph-lock wait while taking the row's ownership, the lazy mutex as the attempt retires, and a native task's completion are recorded under their steps, not as the steps' own time. The span's start is no longer a step: its costly part, gathering the install spans, is one already, and an enclosing step begun on another context made it a sibling the critical path skipped. Ending a task's body updates its part gate under the graph lock; that acquisition now records its wait, under a step of its own. Signed-off-by: Erik Sipsma <[email protected]>
… its modules in one call The built-in Go SDK moves to dagger/go f8c4b0b, whose gobuild discovers a build's modules in a call of its own, cached by the engine, so a warm module load makes about 321 engine requests instead of about 525. go-sdk's daggerGo names the same commit at 98a7945, as the engine image's entries require. 98a7945 changes only go-sdk's daggerGo, which no generated file carries, so this repository's generated modules are unchanged. Signed-off-by: Erik Sipsma <[email protected]>
locatePath looks at a container's mounts from the deepest up. It copied each mount it passed into a new heap object, because it returned the address of its loop variable, and built a "<target>/" string for each, which allocates once the target reaches 32 bytes. A container that builds Go packages carries many mounts, so every lookup allocated twice per mount. Look at each mount in place, match the prefix without building a string, and copy only the mount that matches. Callers still get their own copy. Signed-off-by: Erik Sipsma <[email protected]>
dagger-dev's base was a field with a default, which the constructor evaluates, so every call into dagger-dev built a Wolfi image with git and ripgrep first. Resolving golang's base setting, dag://dagger-dev/go-base, paid about 3 s for it on a fresh engine, though goBase doesn't use it. base is now computed when it is read, as goBase is. Signed-off-by: Erik Sipsma <[email protected]>
A client's log stream decoded every stored row's body and attributes into OTLP messages and then encoded those messages again, once per streaming client. The trace stream already writes its frames straight from the stored rows; the log stream now does the same with clientdb.AppendLogsRequestPB, which writes the bytes proto.Marshal makes of LogsToPB's request, with each row's body and attributes copied as stored. LogsToPB now lists resources in the order their first rows come, as SpansToPB does, instead of in map order, so its output is deterministic. Signed-off-by: Erik Sipsma <[email protected]>
Each export pass of a protected telemetry lane took the whole queue and left it nil, so every burst grew a new queue from nothing by doubling. The lane now keeps the emptied queue a pass took as a spare and starts the queue from it at the next pass, so a burst refills capacity the lane already has. Signed-off-by: Erik Sipsma <[email protected]>
This reverts "engine: don't re-evaluate a files mount's files to read them" and the test that counted its evaluations. That change read a files mount's files from the values one evaluation set, instead of evaluating each again, and read a finished file's path without evaluating it. Since an evaluation of a part already acquired and opened is reused, a repeat evaluation of a finished file takes a read lock and starts no work, and the change no longer measures: on a fresh listing of dagger/dagger's workspace, the reads it saved summed to 222 ms across 786 mounts, and interleaved pairs showed no difference on any step. The code is simpler without it for the same time. The profile steps that split a mount's time, and linking a mount's files without mounting each, stay. Signed-off-by: Erik Sipsma <[email protected]>
The engine builds a GraphQL server for each set of modules a client installs, and a description of its schema (syntax tree and digest) for each view a client asks for. Profiles show the cost of building them, but not how much of it repeats work already done, so it was not clear what sharing them further would save. The engine's /debug/vars now has schemaBuilds: - servers built, split by whether the module set was built before in the same session (on another client's root, or on the same root, and whether as an identical server) or only in another session; - descriptions built through a shared cache, and how many repeat a module set and view built before; and all descriptions built. The records of module sets seen are bounded at 20,000 entries engine-wide and per session; builds past a full record count as untracked. The counting is a few map operations under one engine-wide mutex per server or description built. Measured in CPU profiles of eight test-workspaces runs (32 cores, about 11,000 server builds each), the counting functions took 0.05 to 0.17 CPU-s of 717 to 764: under 0.03%. The profiles don't measure lock waits. Signed-off-by: Erik Sipsma <[email protected]>
Each session kept its own cache of the GraphQL descriptions (syntax tree and digest) of the module sets its clients installed, so every session rebuilt the descriptions earlier sessions had built for the same modules: 35% of descriptions on the test-workspaces suite. A description depends only on the modules' results, their install options and the core schema's view, which its key and the cache's views already cover, so keep the caches engine-wide in a bounded LRU of 128 module sets. Modules whose defaults expand the host's environment keep their private cache, as before. On the test-workspaces suite on 32 cores (2 runs each, interleaved with 2 without the change), 27% fewer descriptions are built, building descriptions takes 9.0 to 9.6 CPU-s instead of 12.3, and the engine allocates 146 to 149 GB instead of 150. Signed-off-by: Erik Sipsma <[email protected]>
…cies The TypeScript SDK passed codegen the module source's ID, as a string argument of its exec, and codegen loaded the source by it, over a connection of its own to the engine, to read the module's name and its dependencies. The ID is a handle to a result of the engine that made it, so the exec's cache key held that handle rather than what codegen read. The SDK now passes the module's name and its dependencies to codegen as they are, the way the Go SDK does. The exec is keyed by what codegen reads, with the introspection JSON as before, and no longer nests a connection to the engine, which only resolving the ID used. Nothing changes for module authors: the generated client is the same. Signed-off-by: Erik Sipsma <[email protected]>
No SDK passes codegen a module source's ID any more: the Go and TypeScript SDKs pass the module's name, engine version and dependencies themselves. generate-client loses the flag and the query that loaded the module source by its ID, and takes what it is passed as it is. Nothing changes for module authors. Signed-off-by: Erik Sipsma <[email protected]>
The Go SDK runtime loads a module's package for codegen through golangci-lint's export driver, which serves the export data of what the module imports from archives dagger/go builds right before. When the driver declines, go/packages falls back to the go command, which compiles every package the module imports from source: codegen still works, many times slower, on every load, and nothing says so. A driver at another manifest format than the archives' writer, or archives built with another Go version, declines every load this way. When the archives are configured, codegen now asks the driver for its report on each request, and fails, quoting the driver's reason, if it declined or didn't report. The archives are built for this load, so no decline is one to recover from. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 9, 2026
Four of the fixes change what users see. The CLI CPU fix reached main with #15080, which added no entry, so its entry names #15080. The dagger check report fix restores behavior from before #15088, which hasn't been released, so it has no entry of its own. Signed-off-by: Erik Sipsma <[email protected]>
This was referenced Nov 9, 2026
Merged
sipsma
added a commit
that referenced
this pull request
Nov 9, 2026
Four of the fixes change what users see. The CLI CPU fix reached main with #15080, which added no entry, so its entry names #15080. The dagger check report fix restores behavior from before #15088, which hasn't been released, so it has no entry of its own. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 10, 2026
Some of test-container's tests load a Go module in an engine that has nothing for it. TestSaveInNested, TestSystemGoProxy, TestSystemCACerts and TestPublishAndFromWithRegistryServiceBinding start fresh engines from the shard's dev engine image, and TestCrossSessionDockerbuildSockets loads one in the shard's engine itself. Before #15080 the image shipped a Go build cache; it now ships the entries instead, and this shard's engine was built without them, so each of those engines builds the Go SDK runtime from nothing, hundreds of package builds each. Build the shard's engine with the entries, as the shards whose tests load Go modules already do. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 10, 2026
Some of test-container's tests load a Go module in an engine that has nothing for it. TestSaveInNested, TestSystemGoProxy, TestSystemCACerts and TestPublishAndFromWithRegistryServiceBinding start fresh engines from the shard's dev engine image, and TestCrossSessionDockerbuildSockets loads one in the shard's engine itself. Before #15080 the image shipped a Go build cache; it now ships the entries instead, and this shard's engine was built without them, so each of those engines builds the Go SDK runtime from nothing, hundreds of package builds each. Build the shard's engine with the entries, as the shards whose tests load Go modules already do. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 10, 2026
Some of test-container's tests load a Go module in an engine that has nothing for it. TestSaveInNested, TestSystemGoProxy, TestSystemCACerts and TestPublishAndFromWithRegistryServiceBinding start fresh engines from the shard's dev engine image, and TestCrossSessionDockerbuildSockets loads one in the shard's engine itself. Before #15080 the image shipped a Go build cache; it now ships the entries instead, and this shard's engine was built without them, so each of those engines builds the Go SDK runtime from nothing, hundreds of package builds each. Build the shard's engine with the entries, as the shards whose tests load Go modules already do. Signed-off-by: Erik Sipsma <[email protected]>
This was referenced Nov 10, 2026
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.
A fresh
dagger -W github.com/dagger/dagger@main check -ltakes 4.53 s with this PR, against 25.39 s on main.Listing this repository's checks no longer compiles anything. Modules on generated entrypoints expose their types without a build. When a Go module does build, it builds per package through dagger/go, on top of a cache of common builds shipped in the engine image. Module loading and check planning also do less work per session.
Results
dagger -W github.com/dagger/dagger@<commit> check -lon one 16-core machine (m8gd.4xlarge, eu-west-2), each sequence on a fresh engine, the repository served from the machine's own Git server so no side pays GitHub's network time. Each side lists its own tree with its own engine: main (7976c6f); this PR (29e3c66; the later commits, to the TypeScript SDK and Go codegen's export-driver check, don't touch the Go workspace path these steps measure), whose modules are generated by go-sdk at dagger/go-sdk#100 with their file lists in the manifest (include), targeting v1.0.0-beta.25; and after the follow-up PR, this PR's engine listing its modules regenerated withdaggerGo(each built per package) for v1.0.0-beta.26, with each go.mod replacingdagger.io/daggerby this PR'ssdk/gountil beta.26 is released (the version string changes, not the code). Cells are medians; the difference is the mean paired difference against main with a 95% bootstrap interval, over 8 alternating pairs. Every listing's output was checked.The first check after a fresh listing is slower: listing no longer compiles, so the first call does. Measured on the same machine with
dagger -W <workspace>@<commit> check release/docs-target-version/stale, 3 alternating pairs (too few for an interval, so each pair's difference against main is listed). Cells are medians. The check downloads about 105 MB, so these numbers depend on the machine's region.Listing plus that first check together still come out ahead: about 15 s against main's 29 s, and about 12 s after the follow-up PR.
Traces: one traced run per step
One run of each step with telemetry on, on the same machine and commits as the tables. Telemetry makes these runs a little slower, so read times from the tables.
CI test time
Test shard times on this PR (one CI run; all 19 shards passed on their first run) against main's median and range over its 10 most recent commits with test results.
17 shards are within main's range and test-provision is under it; test-module-definitions is above it. The longest shard, test-base-extra, is within main's range. Two things keep it close: dagger/go's per-package build makes about 321 engine requests per warm Go module load, and test shards start their dev engine without the engine image's pre-warmed entries, except the five whose tests need them.
What is in it
577 commits. 369 of them are #14828's (remote cache), included because the engine reads the pre-warmed cache through that code. Review those in #14828; whichever of the two merges second rebases and they drop out. #15071 and #14844 are folded in here, the latter under Yves Brissaud's authorship. The rest is below, each change in its own commits.
Go module builds
Directory.withPlatformdeclares a build made for another platform, andModule._prebuild(platform:)andModule._runtimeImage(platform:)give a module's prebuild and runtime image for it. The entries tool reads dagger/go, the runtime image and the build flags from the modules themselves, and fails the image build if go-sdk's dagger/go and the built-in Go SDK's differ. It is merged into the cache at engine start in about 0.5 s. It ships the entries as uncompressed blobs, so an engine decompresses nothing on first use; the download is unchanged and the pulled image takes about 600 MB more disk.check -lcompiles no Go, so this commit doesn't change it; it applies where Go builds after a pause, such as running a check.--module-source-idflag is removed.prebuildmember, which the engine evaluates ahead of the module's first call.File.sync(keyByContent:)evaluates a file and keys it by content in one request, so an exec whose output is unchanged leaves its consumers cached. Engine side only; dagger/go adopts it after a release.module SDK: load runtime. An SDK's work for the engine is marked internal in telemetry, and inside a failed SDK step the frontend shows the step that failed rather than the machinery, including a module entrypoint's faileddispatchexec. With-vit is 18 lines (main: 30; before this, about 18,900). Outside SDK steps nothing changes, and-vvvstill shows everything.Module manifests and loading
includefiles outside its directory in its manifest, so a fixed file list no longer needs asourcesmember that runs on every load.include, eveninclude = [], no longer runs its entrypoint'ssourcesmember, since the context already holds the included files. An engine that predatesincludeignores the key and runssources, so go-sdk can write both and a module loads on every engine.dagger.gen.gofirst; bindings that don't fit take the old path.?dagger-get=1request per address per session and waited up to 5 s.git ls-remotewhen parsing an address on a host no rule knows by name, such asgitlab.com/org/repo.git. The four probes never reached the server or changed the result. About 57 ms per session.sourcescheck of a Dang entrypoint parses through the syntax cache. Fresh listing −0.60 s [−0.94, −0.19], 6 pairs.Git workspaces
+defaultPath="/"argument. It got null when the calling module came from a host checkout or a Git workspace. The release module drops its workaround for this.Remote engines and smaller costs
FindUpcall instead of one stat per level, and connecting asks for engine info once and subscribes to traces, logs and metrics together. Older clients and engines fall back to the old path.This repository's modules
Its Go modules now run through generated Dang entrypoints (Yves Brissaud's commits), generated with go-sdk at dagger/go-sdk#100's head, pinned in
dagger.tomluntil it merges, which keeps their raised dependency versions; a released engine loads them. That go-sdk targets v1.0.0-beta.25 by default (go-sdk main's own change), so the modules target beta.25 and the engine image pre-warms beta.25's Go library, and each manifest lists the module's outside files withincludebeside itssourcesmember.Behaviour changes
GitRepository.asWorkspacereturns the head's workspace when nothing is uncommitted, instead of one with an empty change set on top.ModTreePath.Contains,EqualsandGlobno longer emit debug spans in Cloud traces or--debugoutput.?dagger-get=1request.goprivate, so a laptop and a CI runner share one runtime (measured on a warm engine: a client with different git settings gets it in about 0.25 s, where it rebuilt for about 2 s).goprivatein its config, as documented; without it, the client's git settings don't reach the module's build.Directory.withPlatform.-vvvshows them.includeskips its entrypoint'ssourcesmember.Tests
Each change has tests that fail without it. The main ones:
TestModule/TestDangModuleEntrypointDependencies,TestDangModuleEntrypointDependenciesFeedOnlyTheEntrypoint,TestCommittedTypes,TestFileSyncKeyByContent,TestGoRuntimeSharedAcrossGitSettingsTestRemoteCacheTransferSuite/TestImageEntriesAreUncompressed,TestTransferOntoImageEntryTestCheckPlanningFromGitAcrossSessions,TestLockfile/TestImageSettingResolvesOncePerSessionTestTelemetry/TestGoldenbroken-module cases (default and-vviews),TestUserFunctionsAreNotEngineWork,TestInternalFailureGivesPlaceToItsCauseTestModule/TestModuleEntrypointInclude(asourcesmember that raises if run),TestModuleManifestV2IncludeDeclaredTestModuleLoading/TestServeModuleCallerTree,TestServeModuleCallerTreeCache,TestServeModuleCacheNamespaces,TestGenerators/TestGoClientFromModuleSourceengine-dev/image-entries-after-prunecheck: an image's entries are made again after a prunecoreengine/clientandengine/engineutilunit tests forFindUpand connecting, including an older client and a proxyMerging
sipsma/collections-line: simplify: remove compute.go #95's head plus commits that build for any platform, which need this PR's engine. They go to dagger/go in a PR after the engine release, and the pin moves to its merged commit. This repository's workspace pins an earlier dagger/go that a released engine loads; it moves to simplify: remove compute.go #95's merged commit.export-driver: read dagger/go's version 2 archives, and give builders the manifest format golangci-lint#2 merges first, with a merge commit: the Go SDK image builds the export driver from fix go dependencies for buildkit v0.8.1 #2's head, which has to stay reachable.
go: generate Go 1.27 modules, and build entrypoint modules with dagger/go's per-package build go-sdk#100 also merges first. This repository's workspace pins go-sdk to its head; the pin moves to the merged commit. It is released after the engine release.
This PR has main merged in (not rebased), and carries main's collection-item check reporting, kept across sessions with the rest of a check's planning.
An earlier change that read a files mount's files without evaluating them again is reverted on Erik's decision: once evaluating an already-acquired part was reused, it no longer saved measurable time.
#14902 conflicts with the syntax-cache change in
sources.goandentrypoint.go. Whichever merges second must set the Dang version pin on the context before thesourcescheck, not only before the run.TestDeclaresEntrypointSourcesAtTheContextVersioncovers it.