Skip to content

Conversation

@blt
Copy link
Collaborator

@blt blt commented Jan 12, 2026

What does this PR do?

Avoid allocating a new String on each log line by reusing a Vec buffer. This eliminates format! overhead in the hot loop.

Micro-benchmark (cargo criterion):

  • 1 MB: 84 → 95 MiB/s (+13%)
  • 10 MB: 137 → 171 MiB/s (+25%)
  • 100 MB: 134 → 167 MiB/s (+25%)
  • 1 GB: 134 → 171 MiB/s (+28%)

Macro-benchmark (hyperfine with payloadtool):

  • +17% faster (4.00s → 3.41s mean)

Avoid allocating a new String on each log line by reusing a Vec<u8> buffer.
This eliminates format! overhead in the hot loop.

**Micro-benchmark** (cargo criterion):
- 1 MB: 84 → 95 MiB/s (+13%)
- 10 MB: 137 → 171 MiB/s (+25%)
- 100 MB: 134 → 167 MiB/s (+25%)
- 1 GB: 134 → 171 MiB/s (+28%)

**Macro-benchmark** (hyperfine with payloadtool):
- +17% faster (4.00s → 3.41s mean)

Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
@blt blt requested a review from a team as a code owner January 12, 2026 22:49
@blt blt merged commit c08442d into main Jan 12, 2026
30 of 31 checks passed
@blt blt deleted the optimize-apache-common branch January 12, 2026 23:29
blt added a commit that referenced this pull request Jan 15, 2026
Refactor skills to reduce token usage while preserving functionality:
- Extract shared BENCHMARKING.md and DB_SCHEMA.md references
- Remove duplicated bash blocks (worktree, criterion, hyperfine)
- Convert verbose tutorials to concise checklists
- Trust LLM knowledge of bash/Rust basics

Based on analysis of merged PRs, establishes a standard commit format:
- Title: Action verb + target + technique (no prefixes)
- Body: Brief explanation + benchmark results
- ONE commit per optimization (includes db.yaml update)

Examples from merged PRs analyzed:
- Reuse buffer in Apache Common serialization (#1690)
- Eliminate allocations in Splunk HEC serialization (#1694)
- Use handle-based tag storage in DogStatsD (#1691)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants