---
title: "From hand-tuned Go to self-optimizing code: Building BitsEvolve"
description: "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."
url: "https://swe.quest/articles/from-hand-tuned-go-to-self-optimizing-code-building-bitsevolve-65732e9f0f979e91"
canonical: "https://www.datadoghq.com/blog/engineering/self-optimizing-system/"
source: "Datadog Engineering"
published: "2025-09-18"
difficulty: "medium"
kind: "Case study"
reading_minutes: 17
tags: ["performance","go","ai-agents","cost-optimization","compilers"]
---

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

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2025-09-18, 17 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/self-optimizing-system/](https://www.datadoghq.com/blog/engineering/self-optimizing-system/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Go](https://swe.quest/tags/go.md) (Languages)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)

## Prerequisites

- Go programming ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- CPU profiling ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))
- bounds check elimination
- LLM coding agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

BitsEvolve, AlphaEvolve, Compiler Explorer, Temporal, Live Debugger, CRC32, SIMD, Murmur3

## Related posts

- [How we reduced the size of our Agent Go binaries by up to 77%](https://swe.quest/articles/how-we-reduced-the-size-of-our-agent-go-binaries-by-up-to-77-01b71ba25e3ec4b1.md): Datadog Engineering · 2026-02-18 · Medium · 14 min read · Go, Build systems, Compilers, Performance engineering
  Datadog cut its Agent's Go binary sizes by up to 77% between versions 7.60.0 and 7.68.0 without removing features.
- [KernelEvolve: How Meta’s Ranking Engineer Agent Optimizes AI Infrastructure](https://swe.quest/articles/kernelevolve-how-meta-s-ranking-engineer-agent-optimizes-ai-infrastructure-d31b329bdf84a06a.md): Meta Engineering · 2026-04-02 · Hard · 14 min read · AI agents, Performance engineering, Hardware, Compilers, Recommendations & ranking
  KernelEvolve is Meta's agentic kernel-authoring system that treats kernel optimization as a search problem instead of one-shot LLM code generation.
- [Debugging Go compiler performance in a large codebase](https://swe.quest/articles/debugging-go-compiler-performance-in-a-large-codebase-46b7968c79fa2123.md): incident.io · 2024-01-15 · Medium · 6 min read · Go, Build systems, Developer productivity, Performance engineering
  incident.io sped up builds of its Go monolith by tracing the compiler with \`go build -debug-trace\` and viewing the output in Perfetto.
- [Performance improvements in the Datadog Agent metrics pipeline](https://swe.quest/articles/performance-improvements-in-the-datadog-agent-metrics-pipeline-2d01cccf9e289314.md): Datadog Engineering · 2023-01-31 · Medium · 11 min read · Performance engineering, Go, Observability, Algorithms
  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.
- [Arch-specific SIMD in Go](https://swe.quest/articles/arch-specific-simd-in-go-2992a831c4663686.md): The Go Blog · 2026-10-02 · Hard · 11 min read · Go, Performance engineering, Compilers, Hardware, WebAssembly
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
