Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

incident.io 6 min read Case study mediumAdept

Debugging Go compiler performance in a large codebase

incident.io sped up builds of its Go monolith by tracing the compiler with `go build -debug-trace` and viewing the output in Perfetto. The trace exposed long stretches of idle cores while a large `pkg/domain` package (about 250 table structs, roughly 100k lines) compiled. Using `depguard` to cut that package's dependencies, notably the goldmark markdown library, let it start compiling at about 15s instead of 25s. Moving generated gomega test matchers into a separate `pkg/domain/matchers` package cut the package's compile time by about 30%, which matters because it is rebuilt 10–20 times a day across the team.

Related posts

  • Engineering nits: Generating code faster

    incident.io mediumAdept

    incident.io cut a Go code-generation step from about 16 seconds to under half a second (97% faster) by adding commonly used imports directly to the generator's template. The bottleneck was goimports resolving missing imports, which requires scanning every package in the module and its dependencies, repeated hundreds of times. Removing unused imports is cheap because it only inspects a single file, so over-including imports (with the list built via `go list`) leaves goimports little to resolve. The roughly 20-line change saves about 3 engineer-hours per week for a team of around 20.

  • How we reduced the size of our Agent Go binaries by up to 77%

    Datadog Engineering mediumAdept

    Datadog cut its Agent's Go binary sizes by up to 77% between versions 7.60.0 and 7.68.0 without removing features. The work combined three things: auditing imports with go list, goda and go-size-analyzer; moving code behind build tags or into separate packages; and re-enabling the linker's method dead code elimination. The last required finding reflect.MethodByName uses with -dumpdep and whydeadcode, patching about a dozen dependencies and forking text/template, which yielded 16–25% per binary. A single misplaced function had pulled 570 Kubernetes packages into trace-agent, about 36 MiB, and similar fixes upstream gave Kubernetes 16–37% reductions.

  • Tracking developer build times to decide if the M3 MacBook is worth upgrading

    incident.io mediumAdept

    incident.io built a custom Go hot-reloader that records build telemetry (platform, memory, power source, Go build stages, triggering files) from developer MacBooks and pipes it through Fivetran into BigQuery. About 25k builds were then analysed with an OpenAI code-interpreter assistant. After excluding failed builds and battery-powered runs, which a t-test confirmed are slower, the analysis bucketed builds by Go cache behaviour. The M2 Pro was roughly twice as fast as the M1 Pro, and doubling memory made little difference. The M3 Max showed no remarkable gain over the M3 Pro, so the company decided to buy M3 Pros.

  • From hand-tuned Go to self-optimizing code: Building BitsEvolve

    Datadog Engineering mediumAdept

    Datadog cut CPU in Go hot paths by removing compiler bounds checks in NormalizeTag (25% faster, 0.75% service CPU) and adding an ASCII fast path to NormalizeTagArbTagValue (90% faster, hundreds of thousands of dollars in projected annual savings), guided by production data showing nearly all inputs were ASCII. These manual techniques became the heuristics for BitsEvolve, an AlphaEvolve-inspired agent that uses an island-model evolutionary algorithm, benchmark fitness functions and Temporal orchestration to mutate code. BitsEvolve rediscovered the hand-tuned versions and improved Murmur3 and CRC32 by about 20%. The key lesson is that realistic benchmarks matter, so production data captured with Live Debugger is used to build trustworthy fitness functions, and the work then extends toward SIMD kernels for Go.

  • The quest for the five minute deploy

    incident.io mediumAdept

    incident.io cut CI/CD times by moving from a hosted provider, where a cold Go build cache made compiling 15,000+ tests across 350+ packages the bottleneck, to Buildkite running on three self-hosted 48-vCPU servers. Prebuilding Ginkgo test binaries and running them in batches on a single server, plus per-server Go build caches, per-yarn.lock Node module caches with pipeline fallback, and local Docker image caches, brought the test step to 2–4 minutes. Production deploys fell from 11.5 to 8.5 minutes, branch builds from 10 to 5.5, and hotfixes to 3.5. Remaining pain points include bin packing containers, under-provisioned disk IOPS, newly exposed flaky tests, cache poisoning, zombie containers, and a fast-growing cache that must be cleared wholesale.

The quest for software engineering knowledge.

Look:
Layout: