Skip to content
ProgrammingDevOps

One Rust function was eating a third of CPU just to move memory around; a single PR made it 10x faster

This post walks through a GreptimeDB performance PR that rewrites one function on the Prometheus remote read path — the conversion from columnar RecordBatch to row-oriented TimeSeries. The old code built an owned label vector for every row, materializing strings unnecessarily; the PR borrows directly from Arrow arrays and moves allocation from per-row to per-series. The author benchmarks both sides and finds 4-16x improvement, with the best cases exceeding 10x. A notable subplot: dictionary encoding was 35% slower than plain strings before the fix, despite existing specifically to save copies.

Read full article →