Skip to content

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
sipsma merged 577 commits into
mainfrom
sipsma/faster-unchanged-reruns
Nov 9, 2026
Merged

sipsma merged 577 commits into
mainfrom
sipsma/faster-unchanged-reruns

Conversation

@sipsma

@sipsma sipsma commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

A fresh dagger -W github.com/dagger/dagger@main check -l takes 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 -l on 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 with daggerGo (each built per package) for v1.0.0-beta.26, with each go.mod replacing dagger.io/dagger by this PR's sdk/go until 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.

Step main This PR After the follow-up PR
Fresh engine 25.39 s 4.53 s, −20.83 s [−21.50, −20.17] 4.60 s, −20.78 s [−21.51, −20.09]
Unchanged rerun 1.02 s 0.61 s, −0.42 s [−0.45, −0.40] 0.61 s, −0.41 s [−0.43, −0.39]
After main moved 2.23 s 1.62 s, −0.59 s [−0.63, −0.54] 1.65 s, −0.57 s [−0.59, −0.55]
After a docs-only edit 2.18 s 1.46 s, −0.59 s [−0.74, −0.32] 1.52 s, −0.66 s [−0.67, −0.64]
After a Go code edit 2.21 s 1.46 s, −0.77 s [−0.83, −0.73] 1.52 s, −0.72 s [−0.77, −0.68]

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.

main This PR After the follow-up PR
First check right after a fresh listing 3.57 s 10.90 s, +8.47 s (pairs +6.43, +11.62, +7.37) 7.19 s, +3.31 s (pairs +2.59, +3.68, +3.66)
The same check alone on a fresh engine 29.61 s 13.34 s, −15.61 s (pairs −16.16, −17.25, −13.41) 9.57 s, −19.40 s (pairs −20.04, −20.99, −17.17)

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.

Step main This PR After the follow-up PR
Fresh trace trace trace
After main moved trace trace trace
Unchanged trace trace trace
After a docs edit trace trace trace
After a Go code edit trace trace trace
Listing before the first check trace trace trace

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.

Shard main median (range) This PR vs main median
test-base 10m52s (8m54s–13m04s) 10m31s 0.97×
test-base-extra 10m01s (8m12s–15m59s) 10m36s 1.06×
test-cache-persistence 5m49s (4m33s–9m38s) 8m19s 1.43×
test-call-and-shell 4m30s (3m39s–8m28s) 5m03s 1.12×
test-cli-engine 4m00s (3m09s–4m45s) 3m41s 0.92×
test-container 6m30s (3m37s–13m02s) 6m22s 0.98×
test-ebpf 1m38s (1m11s–2m41s) 1m36s 0.98×
test-ebpf-exec-sched 1m45s (1m25s–2m42s) 1m56s 1.10×
test-fastbolt 1m20s (1m02s–1m54s) 1m12s 0.90×
test-interface 4m11s (3m14s–8m29s) 4m08s 0.99×
test-llm 3m30s (2m10s–4m42s) 3m18s 0.94×
test-local-cache 4m13s (3m08s–5m21s) 4m02s 0.96×
test-module-definitions 4m59s (3m38s–6m12s) 7m04s 1.42×
test-module-runtimes 7m55s (4m52s–13m09s) 6m07s 0.77×
test-modules 6m59s (5m32s–12m45s) 7m56s 1.14×
test-packages 5m48s (4m01s–7m51s) 7m19s 1.26×
test-provision 7m09s (5m49s–8m25s) 5m01s 0.70×
test-telemetry 5m33s (4m44s–6m34s) 4m46s 0.86×
test-workspaces 4m56s (3m31s–11m10s) 4m07s 0.83×
All 19 shards 101m38s 103m04s 1.01×

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

  • Every Go module runtime builds through dagger/go's per-package build (go: per-package builds that share module downloads and plans, with faster edits, lints and gobuild loads go#95): one exec per package, cached by what it compiles, so modules and projects share builds. The built-in Go SDK becomes a Dang module SDK shipped in the engine image. The engine's own Go build code and its Go build cache volume are removed.
  • The engine image ships a pre-warmed cache: the builds of the standard library and of what every Go module's generated code imports, dagger/go's tools, and the images they run in. Nothing in it is specific to one project. It is made at image build for each platform, by an engine of the image's own build on the build machine, without emulation: Directory.withPlatform declares a build made for another platform, and Module._prebuild(platform:) and Module._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.
  • Codegen compiles nothing: it reads its imports' export data from dagger/go's archives, through an export driver built from dagger/golangci-lint. The engine's own copy of the driver is removed.
  • A package build links its dependencies' archives into place without a mount per archive. On the one line, check -l compiles no Go, so this commit doesn't change it; it applies where Go builds after a pause, such as running a check.
  • A module whose go.mod names a Go version below the SDK's no longer has its dependencies compiled from source on every load and edit: the export driver now serves codegen whatever the module's Go version.
  • Go codegen fails with the export driver's reason when the driver declines, instead of quietly compiling every dependency from source.
  • A client is generated from its module's name, engine version and dependencies, not from its module source's ID, for both the Go and TypeScript SDKs, so the codegen step's cache key no longer names one engine's result and codegen no longer connects to the engine. Codegen's --module-source-id flag is removed.
  • An entrypoint can declare a prebuild member, which the engine evaluates ahead of the module's first call.
  • Module runtimes compile without debug information, and their generated client without inlining. The link already stripped debug information, so generating it cost about 10% of each compile's CPU for nothing; inlining was about half of the generated client's compile, and its functions only build a query and make a network call. Runtime binaries held no debug information before either, so debuggers and stack traces lose nothing.
  • The Go SDK's dependency versions are raised to the highest this repository's modules use (otel 1.46, gRPC 1.82.1, x/net 0.59), so modules hit the pre-warmed cache instead of resolving past it.
  • 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.
  • When a Go module, or a dependency of it, fails to compile, the output shows the compile error as main does: the failed step, titled with its package, and the compiler's error with file and line, under 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 failed dispatch exec. With -v it is 18 lines (main: 30; before this, about 18,900). Outside SDK steps nothing changes, and -vvv still shows everything.

Module manifests and loading

  • A version-2 manifest can list an entrypoint's dependencies (from core: version 2 module manifests list an entrypoint's dependencies #15071). The engine loads them into the entrypoint's schema. This is how a generated entrypoint calls dagger/go. A module's entrypoint dependencies, such as the dagger/go every go-sdk module is built with, are visible only to its entrypoint, so a module can sit beside another module of the same name and sessions no longer load those dependencies' types.
  • A module can include files outside its directory in its manifest, so a fixed file list no longer needs a sources member that runs on every load.
  • A manifest that declares include, even include = [], no longer runs its entrypoint's sources member, since the context already holds the included files. An engine that predates include ignores the key and runs sources, so go-sdk can write both and a module loads on every engine.
  • A committed Go module's API is read from its bindings instead of compiling the module to run one generated expression. The engine type-checks dagger.gen.go first; bindings that don't fit take the old path.
  • Modules in a batch load all at once instead of 8 at a time, Git workspace modules share one workspace result, and runtimes prebuild one per CPU instead of 4 at once. A cycle through joined calls is now an error instead of a hang.
  • No vanity-redirect probe for known code hosts. Loading a module from github.com sent a ?dagger-get=1 request per address per session and waited up to 5 s.
  • No git ls-remote when parsing an address on a host no rule knows by name, such as gitlab.com/org/repo.git. The four probes never reached the server or changed the result. About 57 ms per session.
  • The sources check of a Dang entrypoint parses through the syntax cache. Fresh listing −0.60 s [−0.94, −0.19], 6 pairs.
  • No debug span per module path comparison. They were thousands of spans in one burst during a listing.

Git workspaces

  • A filtered read that the workspace's sparse tree doesn't cover gets a sparse tree of its own, keyed by the files it selects, instead of a full checkout. A read of files a commit didn't change does nothing again.
  • Check planning is reused across sessions for a workspace identified by its content: discovery, item listings and each check's object. A failed check, a listing whose items could change, and per-call or per-session checks are never kept. Unchanged rerun of 1,233 checks: 3.23 → 2.05 s, 4 pairs.
  • An image address in a module setting resolves once per session, and by its pin where the lockfile pins it, so listings over a pinned tag are reused across sessions.
  • A Git module in an edited workspace is keyed on the workspace's content. Fixes a wrong cache hit: at the same commit, a workspace with an edit to a served module got the unedited answer.
  • A served module's local dependencies keep the serving module's origin (from core: dependencies of a served module keep its cache namespace #14844), so they use the same cache volumes as the module loaded directly.
  • A module served from another module's local tree, as a generated client is, gets its git-typed +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

  • Fewer round trips to the client: the engine finds a client's directories with one FindUp call 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.
  • Image layers decompress with reused zstd decoders. A new decoder allocated about 27 MB per layer, however small.
  • A call's logged result is cut at 64 KiB, with a line saying how many bytes were left out; the value returned is unchanged. The Go test suite logs 54% less text.
  • A field's inputs are computed once per view, an opened part is reused, and a profiled response is stamped per request.

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.toml until 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 with include beside its sources member.

Behaviour changes

  • The engine's Go build cache volume and Go build code are gone; Go module runtimes build through dagger/go.
  • Listing a workspace no longer compiles Go modules that have committed bindings. The build happens at the first call.
  • Planning results from a Git workspace outlive the session and engine restarts. No result changes.
  • Any edit in a Git workspace makes its Git modules' calls run again. Before, only edits to the module's own files did.
  • GitRepository.asWorkspace returns the head's workspace when nothing is uncommitted, instead of one with an empty change set on top.
  • When connecting, the first of the trace, log and metric subscriptions to fail cancels the others and is the error reported.
  • ModTreePath.Contains, Equals and Glob no longer emit debug spans in Cloud traces or --debug output.
  • Known code hosts no longer receive a ?dagger-get=1 request.
  • A Go module's runtime no longer depends on the calling client's git identity or SSH agent: the engine gives the Go SDK the client's git URL rewrites and SSH agent only for a module that sets 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).
  • A Go module with a private dependency needs goprivate in its config, as documented; without it, the client's git settings don't reach the module's build.
  • A module served from another module's local tree gets its git-typed default argument instead of null.
  • New API: Directory.withPlatform.
  • A broken Go module's output no longer lists the Go SDK's and dagger/go's internal steps; -vvv shows them.
  • A version-2 manifest with include skips its entrypoint's sources member.
  • Loading a Go module resolves the built-in Go SDK's dagger/go dependency from github.com, so it needs network access to GitHub, which main didn't. It's pinned by commit; whether the engine can skip that request when the image already ships that commit's tree is still open.

Tests

Each change has tests that fail without it. The main ones:

  • TestModule/TestDangModuleEntrypointDependencies, TestDangModuleEntrypointDependenciesFeedOnlyTheEntrypoint, TestCommittedTypes, TestFileSyncKeyByContent, TestGoRuntimeSharedAcrossGitSettings
  • TestRemoteCacheTransferSuite/TestImageEntriesAreUncompressed, TestTransferOntoImageEntry
  • TestCheckPlanningFromGitAcrossSessions, TestLockfile/TestImageSettingResolvesOncePerSession
  • TestTelemetry/TestGolden broken-module cases (default and -v views), TestUserFunctionsAreNotEngineWork, TestInternalFailureGivesPlaceToItsCause
  • TestModule/TestModuleEntrypointInclude (a sources member that raises if run), TestModuleManifestV2IncludeDeclared
  • TestModuleLoading/TestServeModuleCallerTree, TestServeModuleCallerTreeCache, TestServeModuleCacheNamespaces, TestGenerators/TestGoClientFromModuleSource
  • the engine-dev/image-entries-after-prune check: an image's entries are made again after a prune
  • narrowed reads compared against plain checkouts across commits, in core
  • engine/client and engine/engineutil unit tests for FindUp and connecting, including an older client and a proxy

Merging

  1. go: per-package builds that share module downloads and plans, with faster edits, lints and gobuild loads go#95 first. The built-in Go SDK pins dagger/go's 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.
  2. This PR, then an engine release.
  3. A go-sdk release with go: generate Go 1.27 modules, and build entrypoint modules with dagger/go's per-package build go-sdk#100, Run alpine through a generated Dang entrypoint alpine#8, Write wolfi in Dang, calling alpine lazily wolfi#7, then Move the repository's Go modules to the go-sdk Dang entrypoint #15070, which regenerates this repository's modules for the released engine.

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.go and entrypoint.go. Whichever merges second must set the Dang version pin on the context before the sources check, not only before the run. TestDeclaresEntrypointSourcesAtTheContextVersion covers it.

@sipsma
sipsma force-pushed the sipsma/faster-unchanged-reruns branch from 2cc937f to 1791150 Compare November 5, 2026 09:30
@sipsma sipsma changed the title Faster unchanged check runs: resolve image addresses once, and reuse a Git workspace's planning across sessions Faster dagger check -l and check reruns on a Git workspace Nov 5, 2026
@sipsma sipsma changed the title Faster dagger check -l and check reruns on a Git workspace Faster dagger check -l and check reruns on a Git workspace, and module calls that follow the modules they serve Nov 5, 2026
@sipsma sipsma changed the title Faster dagger check -l and check reruns on a Git workspace, and module calls that follow the modules they serve Faster dagger check -l and check reruns on a Git workspace, and Git module keys that cover a workspace's uncommitted edits Nov 5, 2026
@sipsma
sipsma force-pushed the sipsma/faster-unchanged-reruns branch 3 times, most recently from e2945a3 to f2dc4f3 Compare November 5, 2026 20:14
@sipsma
sipsma requested review from a team as code owners November 5, 2026 20:14
@sipsma sipsma changed the title Faster dagger check -l and check reruns on a Git workspace, and Git module keys that cover a workspace's uncommitted edits Fresh 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 planning Nov 5, 2026
@sipsma
sipsma force-pushed the sipsma/faster-unchanged-reruns branch from f2dc4f3 to ace14d5 Compare November 5, 2026 20:16
@sipsma sipsma changed the title Fresh 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 planning Fresh dagger check -l of dagger/dagger in 6 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planning Nov 5, 2026
@sipsma
sipsma force-pushed the sipsma/faster-unchanged-reruns branch from 2a9ece0 to 874f572 Compare November 5, 2026 21:14
…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]>
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]>
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]>
@sipsma
sipsma merged commit 99773d5 into main Nov 9, 2026
96 of 97 checks passed
@sipsma
sipsma deleted the sipsma/faster-unchanged-reruns branch November 9, 2026 20:10
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 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]>
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.

3 participants