Skip to content

bench(engine): DeletePlanMap insert/take contention vs alternatives (#2258) - #4261

Merged
oferchen merged 1 commit into
masterfrom
bench/delete-plan-map-contention-2258
May 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
bench/delete-plan-map-contention-2258

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds crates/engine/benches/delete_plan_map_contention.rs, a Criterion bench that pits the current Mutex<HashMap<PathBuf, DeletePlan>> backing store for DeletePlanMap against dashmap::DashMap and a 16-shard Vec<Mutex<HashMap>> variant.
  • Workloads in group delete_plan_map_contention: 100k_inserts_single_thread, 100k_inserts_{4,8,16}_threads, and mixed_50_50_insert_take at 8 threads. Keys are deterministic PathBuf::from(format!("dir/{group}/{n}")) values so runs reproduce across machines.
  • Pins dashmap as a [target.'cfg(unix)'.dev-dependencies] entry (workspace version 6.1); no runtime dependency change. Registers the bench under [[bench]] and gates the file with #![cfg(unix)] to match the existing criterion dev-dep gating.

Why

DDP-B4 (#2258) is the evidence step for the backing-store choice flagged in plan_map.rs and in the DDP-A3 (#2253) follow-up. If any alternative shows a >2x speedup at the 8/16-thread or mixed workloads, a follow-up PR swaps plan_map.rs to the winner; otherwise the existing shape stays as the simplest correct shape.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings
  • cargo bench -p engine --bench delete_plan_map_contention -- --quick on Linux to smoke the harness
  • CI: fmt+clippy, nextest (stable), Windows, macOS, Linux musl

…2258)

Adds a Criterion micro-benchmark that pits the current
`Mutex<HashMap<PathBuf, DeletePlan>>` backing store for `DeletePlanMap`
against `dashmap::DashMap` and a 16-shard `Vec<Mutex<HashMap>>` variant.
Workloads sweep single-thread, 4/8/16-thread inserts and a 50/50
insert/take mix at 8 threads with deterministic, reproducible keys.

Output feeds the DDP-A3 (#2253) follow-up: if any alternative shows a
>2x speedup at high thread counts, the engine swaps the backing store
to the winner; otherwise the existing shape stays.

dashmap is added only as a `[target.'cfg(unix)'.dev-dependencies]`
entry pinned to the workspace version (6.1); no runtime dependency
change. The bench file is `#![cfg(unix)]`-gated to match the existing
criterion dev-dep gating in the engine crate.
@oferchen
oferchen merged commit 39d399d into master May 17, 2026
12 of 14 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
…2258) (#4261)

Adds a Criterion micro-benchmark that pits the current
`Mutex<HashMap<PathBuf, DeletePlan>>` backing store for `DeletePlanMap`
against `dashmap::DashMap` and a 16-shard `Vec<Mutex<HashMap>>` variant.
Workloads sweep single-thread, 4/8/16-thread inserts and a 50/50
insert/take mix at 8 threads with deterministic, reproducible keys.

Output feeds the DDP-A3 (#2253) follow-up: if any alternative shows a
>2x speedup at high thread counts, the engine swaps the backing store
to the winner; otherwise the existing shape stays.

dashmap is added only as a `[target.'cfg(unix)'.dev-dependencies]`
entry pinned to the workspace version (6.1); no runtime dependency
change. The bench file is `#![cfg(unix)]`-gated to match the existing
criterion dev-dep gating in the engine crate.
oferchen added a commit that referenced this pull request May 18, 2026
…2258) (#4261)

Adds a Criterion micro-benchmark that pits the current
`Mutex<HashMap<PathBuf, DeletePlan>>` backing store for `DeletePlanMap`
against `dashmap::DashMap` and a 16-shard `Vec<Mutex<HashMap>>` variant.
Workloads sweep single-thread, 4/8/16-thread inserts and a 50/50
insert/take mix at 8 threads with deterministic, reproducible keys.

Output feeds the DDP-A3 (#2253) follow-up: if any alternative shows a
>2x speedup at high thread counts, the engine swaps the backing store
to the winner; otherwise the existing shape stays.

dashmap is added only as a `[target.'cfg(unix)'.dev-dependencies]`
entry pinned to the workspace version (6.1); no runtime dependency
change. The bench file is `#![cfg(unix)]`-gated to match the existing
criterion dev-dep gating in the engine crate.
@oferchen
oferchen deleted the bench/delete-plan-map-contention-2258 branch May 19, 2026 19:28
oferchen added a commit that referenced this pull request Aug 24, 2026
…2258) (#4261)

Adds a Criterion micro-benchmark that pits the current
`Mutex<HashMap<PathBuf, DeletePlan>>` backing store for `DeletePlanMap`
against `dashmap::DashMap` and a 16-shard `Vec<Mutex<HashMap>>` variant.
Workloads sweep single-thread, 4/8/16-thread inserts and a 50/50
insert/take mix at 8 threads with deterministic, reproducible keys.

Output feeds the DDP-A3 (#2253) follow-up: if any alternative shows a
>2x speedup at high thread counts, the engine swaps the backing store
to the winner; otherwise the existing shape stays.

dashmap is added only as a `[target.'cfg(unix)'.dev-dependencies]`
entry pinned to the workspace version (6.1); no runtime dependency
change. The bench file is `#![cfg(unix)]`-gated to match the existing
criterion dev-dep gating in the engine crate.
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