Engineering nits: Generating code faster
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.
Related posts
- Debugging Go compiler performance in a large codebase
incident.io mediumAdeptincident.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.
- DevEx matters for coding agents, too
incident.io mediumAdeptincident.io cut its typical lint-plus-compile feedback loop from over 90 seconds to under 10, arguing that fast toolchains matter even more when AI coding agents generate code faster than slow tools can validate it. The gains came from replacing ESLint and Prettier with Biome (40s to under 1s), adopting the preview Go-based TypeScript compiler tsgo while keeping tsc on CI as a safety net, and switching tasks from Node/Yarn to Bun. The team also replaced the Java OpenAPI Generator with a ~700-line Bun/TypeScript generator, built with Claude Code to match the old output exactly, which cut generation from 45s to 0.21s. An upstream Goa PR added parallel file writing and cut its generation time from 52s to 10s.
- How we reduced the size of our Agent Go binaries by up to 77%
Datadog Engineering mediumAdeptDatadog 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 mediumAdeptincident.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.
- The quest for the five minute deploy
incident.io mediumAdeptincident.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.