Skip to content

bench: criterion benches for the DogStatsD hot path and the agent config load - #198

Open
duncanista wants to merge 2 commits into
mainfrom
jordan.gonzalez/benches/feature
Open

duncanista wants to merge 2 commits into
mainfrom
jordan.gonzalez/benches/feature

Conversation

@duncanista

@duncanista duncanista commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Jira: SVLS-9977

  • crates/dogstatsd/benches/hotpath.rs: criterion benches for the DogStatsD hot path, in the
    groups dogstatsd/{parse,packet,insert,flush,compress,ustr}: metric parse, a
    20-line packet, context insert and sketch merge, the series and sketch flush copies and
    encodes, zstd stream against bulk compression, and the ustr
    interner first use and growth.
  • crates/datadog-agent-config/benches/load.rs: config/{get_config,get_config_yaml,replace_rules}
    with the none, typical and heavy environment sets of a Lambda sandbox, a datadog.yaml, and
    the replace-rule compile.
  • criterion 0.5 as a dev-dependency of both crates, with default-features = false (no
    plotters, no rayon, so the benches run on one thread; the set_var calls rely on that).
    [lib] bench = false, so cargo bench runs only criterion. The lock and
    LICENSE-3rdparty.csv add criterion's crates.
  • .github/workflows/cargo.yml: clippy runs with --all-targets, so the benches stay compiling.

Motivation

The extension runs at about 0.07 vCPU at 128 MB, so per-metric and per-flush costs show up in
billed duration. Each performance fix in these crates should come with a before and after
number from a bench. The bottlecap side of the suite is in datadog-lambda-extension
(bottlecap/benches/), which links to these groups.

Additional Notes

The benches use the system allocator, not jemalloc as the extension does, so compare ratios
(fix against main), not absolute times with bottlecap's numbers. The workspace release profile
(opt-level = "z", LTO) applies to cargo bench; for a quick local run use
CARGO_PROFILE_BENCH_LTO=false CARGO_PROFILE_BENCH_CODEGEN_UNITS=16.

Describe how to test/QA your changes

On a copy of main at b6aa5fa with this change:

  • cargo fmt --all -- --check: pass.
  • cargo clippy --locked -p dogstatsd -p datadog-agent-config --all-features --all-targets -- -D warnings: pass.
  • CARGO_PROFILE_BENCH_LTO=false CARGO_PROFILE_BENCH_CODEGEN_UNITS=16 cargo bench --no-run --locked -p dogstatsd -p datadog-agent-config: pass (2 bench executables).
  • The bench author also ran cargo clippy --workspace --all-targets and the license check.

Patch: sc-bench.patch in this folder (a copy of the bench branch diff against b6aa5fa).

@duncanista
duncanista requested review from a team as code owners October 28, 2026 19:01
@duncanista
duncanista requested review from apiarian-datadog and shreyamalpani and removed request for a team October 28, 2026 19:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T19:04:44.506605Z 6e5e1db PR opened
🔒 Security Review ✅ Completed 2026-10-28T19:04:58.841913Z 6e5e1db PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@duncanista duncanista changed the title [SVLS-9977] bench: criterion benches for the DogStatsD hot path and the agent config load bench: criterion benches for the DogStatsD hot path and the agent config load Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant