CHAPTER 1 / 8
Measure workload before language
Selecting a language for performance starts with actual bottlenecks that prevent meeting user SLOs and the cost of change, not benchmark rankings.
Why this concept became necessary
Break request latency into network, queue, application CPU, database, and model inference. If application CPU accounts for 5%, making that part twice as fast produces only a small overall improvement.
Comparisons are reproducible only when representative input, warmup, concurrency, percentiles, and resource limits are fixed. Looking only at averages can miss tail latency, memory pressure, and garbage collection pauses.
Selecting a language for performance starts with actual bottlenecks that prevent meeting user SLOs and the cost of change, not benchmark rankings.
Profiles and benchmarks quantify the share of time and resources that can be optimized.
Combine the production trace's time share with a benchmark under the same conditions to calculate the upper bound on expected overall improvement.
Follow it through a concrete system
Changing languages merely because responses are slow can miss the actual bottleneck in network waits, database queries, model inference, or serialization. Break down end-to-end time using traces and measure CPU profiles, allocations, queues, and downstream capacity to identify the share attributable to application code. The maximum reducible share of elapsed time cannot exceed the share occupied by that bottleneck.
Representative workloads must include large payloads, concurrent users, and error conditions, not just average requests. Even if a parser is twice as fast in a microbenchmark, the change in user latency may be small if parsing accounts for only 5% of the full request. Compare rewrite decisions by total cost, including throughput, tail latency, library maturity, deployment complexity, the team’s review capacity, and incident-response time.
Selection criteria and failure boundaries
An unrepresentative workload or microbenchmark distorts production conclusions.
Misconceptions to avoid: Rewriting in a compiled language does not speed up network or model latency.
Verify it yourself
Combine the production trace's time share with a benchmark under the same conditions to calculate the upper bound on expected overall improvement.
Official sources for this chapter
The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.
- OpenTelemetry, 「Signals」Review date 2026-08-28 · Scope Latest official documentation
- Anthropic, 「Demystifying Evals for AI Agents」Review date 2026-08-28 · Scope Latest official documentation