Skip to content

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

Datadog Engineering 17 min read Case study mediumAdept

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

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.

Assumes: Go programmingCPU profilingbounds check eliminationLLM coding agents

Related posts

  • 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.

  • KernelEvolve: How Meta’s Ranking Engineer Agent Optimizes AI Infrastructure

    Meta Engineering hardMaster

    KernelEvolve is Meta's agentic kernel-authoring system that treats kernel optimization as a search problem instead of one-shot LLM code generation. Monte Carlo tree search and evolutionary strategies explore hundreds of candidate kernels across Triton, CuTe DSL, FlyDSL, CUDA, HIP and MTIA C++. Nodes use configurable memory operators that draw on parent, sibling or no history. A retrieval-augmented, self-updating knowledge base supplies hardware documentation and distilled optimization skills, and an evaluation harness (TritonBench, PyTorch Profiler, NCU, Proton, MTIA Insight) feeds diagnoses of memory-bound, compute-bound or occupancy limits back to the LLM. Results include over 60% inference throughput gain for the Andromeda ads model on NVIDIA GPUs and over 25% training throughput gain on MTIA, achieved in hours rather than weeks of expert tuning.

  • Debugging Go compiler performance in a large codebase

    incident.io mediumAdept

    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.

  • Performance improvements in the Datadog Agent metrics pipeline

    Datadog Engineering mediumAdept

    Profiling the Go-based Datadog Agent under heavy DogStatsD load showed that computing a unique context key per metric, especially sorting and deduplicating tags, dominated CPU. Datadog specialized the sort by tag count, switched to murmur3 with 64-bit keys to hit Go's fast map paths, and then replaced ordered hash chaining with order-independent XOR of tag hashes, deduplicated through a reusable fixed-size custom hash set that removes sorting entirely. Micro-benchmarks show context generation 11–80% faster depending on tag count, and at ~200k metrics/s on 4-core VMs Agent CPU fell about 40% (1 core vs 1.6).

  • Arch-specific SIMD in Go

    The Go Blog hardMaster

    Go 1.27 extends the experimental architecture-specific SIMD API (simd/archsimd, enabled with GOEXPERIMENT=simd) from amd64 to arm64 NEON and wasm 128-bit SIMD. The design uses typed vector structs, readable method names unified across architectures, opaque mask types that the compiler peepholes into masked instructions, and new zero-cost reinterpretation methods (ToBits, ReshapeToUint<W>s) that replace Go 1.26's As<Type> methods. Worked examples reverse bits with GFNI affine transforms and transpose an 8x8 matrix with AVX2 lane-grouped permutes. Practical advice: guard code with CPU feature checks, which avoid SIGILL and also enable fused AVX-512 lowering; write loop bounds as i < len-n+1 so bounds checks are eliminated; and pass vectors as separate values rather than arrays or structs so they stay in registers.

The quest for software engineering knowledge.

Look:
Layout: