Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Performance and benchmarks

Deloxide was evaluated with lock microbenchmarks, heavily contended workloads, correctness controls, stress-driven manifestation tests, and a shared-state raytracer. The complete study is described in the preprint “Deloxide: Low-Overhead Real-time Deadlock Detection and Visualization Framework for Rust”.

The full cross-tool benchmark suite has not been rerun for 1.1. A focused 1.1 microbenchmark checks whether the correctness fixes changed the default fast path. It is a no-regression check, not a replacement for the full evaluation.

Abbreviations:

  • STD: std::sync;
  • PL+DD: parking_lot with deadlock_detection;
  • ND: no_deadlocks;
  • DX: Deloxide default;
  • DX (LOG): Deloxide logging and visualization; and
  • DX (COMP): Deloxide component-based stress mode.

What was tested

The evaluation separates five questions:

  1. Primitive cost: how much latency does tracking add to an isolated lock operation?
  2. Contended throughput: how do the implementations behave from 4 to 64 competing threads?
  3. Correctness: do deterministic cycles produce reports, and do nine complex safe patterns remain free of active WFG reports?
  4. Manifestation: how often does each scheduling strategy make a timing-sensitive deadlock occur?
  5. Application impact: what happens in a raytracer with 8 workers and 129,600 critical sections per 1080p frame?

These measurements should not be collapsed into one number. Stress mode is supposed to slow and perturb a test. The production-oriented comparison is the default fast path.

Lock microbenchmarks

MetricSTDPL+DDDXDX (LOG)DX (COMP)ND
Mutex lock8.7 ns9.9 ns10.8 ns58.1 ns229.4 ns10,527 ns
RwLock write10.1 ns12.8 ns13.9 ns57.7 ns234.1 ns10,797 ns
RwLock read13.9 ns16.1 ns62.4 ns85.5 ns222.5 ns10,895 ns
Condvar17.1 µs17.2 µs19.6 µs17.4 µs20.3 µs2,100 µs

Default Deloxide stays close to the primitive baselines in the focused Mutex, write-lock, and Condvar cases. RwLock reads cost more because Deloxide must count live readers for later writer dependencies. Logging adds event construction and queueing. Component stress adds intentional delay and should never be interpreted as production overhead.

Contended workloads

The macrobenchmarks measure complete workloads rather than one lock operation. The producer-consumer test is write-heavy; the concurrent-read test exercises shared RwLock access.

Producer-consumerPL+DDDXDX (COMP)ND
4x4 threads0.22 ms0.28 ms29.7 ms98,000 ms
16x16 threads1.25 ms1.81 ms122.0 msTimeout
64x64 threads7.60 ms20.2 ms488.6 msTimeout
Concurrent readsPL+DDDXDX (COMP)ND
4 threads0.33 ms0.37 ms10.7 ms25.1 ms
16 threads3.2 ms1.6 ms87.1 msTimeout
64 threads13.9 ms10.6 ms356.6 msTimeout

The default path follows PL+DD closely at low contention. It costs more in the write-heavy 64x64 case and is faster in the read-heavy 16-thread and 64-thread cases. These results describe the tested workloads, not a universal ranking.

Raytracing workload

The application benchmark uses a shared, tile-based framebuffer. At 1920×1080, workers perform 129,600 lock acquisitions per frame while tracing a scene with a maximum recursion depth of 50.

Configuration426×240854×4801280×7201920×1080
STD0.81 s ± 0.033.41 s ± 0.157.33 s ± 0.3117.22 s ± 0.65
PL+DD0.81 s ± 0.003.26 s ± 0.027.19 s ± 0.0318.32 s ± 0.06
DX (default)0.80 s ± 0.003.18 s ± 0.017.09 s ± 0.0316.67 s ± 0.09
ND33.0 s ± 31.4220.9 s ± 182192.9 s ± 281329.1 s ± 554

In the full evaluation, Deloxide completed the 1080p workload 9% faster than PL+DD. Detection does not inherently make an application faster; the result reflects the complete lock implementation and the workload’s contention shape.

Stress-testing manifestation

Each method ran the same deliberately deadlocking scenarios repeatedly without barriers. This measures whether the schedule forms the deadlock, not whether a detector can recognize a cycle that already exists.

ScenarioPL+DDNDDX passiveDX component
Two-lock cycle25%74%17%99%
Three-lock cycle77%99%88%100%
Five-lock cycle100%99%100%100%
Dining philosophers54%76%40%99%
RwLock cycle60%100%41%100%
Average63.2%89.6%57.2%99.6%

The component strategy’s purpose is to make latent schedules appear during testing. These percentages are manifestation rates for the evaluated scenarios, not a claim that every real-world deadlock will reproduce.

Correctness and safe-pattern controls

With barriers enabled, Deloxide, PL+DD, and ND detected every deterministic ground-truth cycle in the evaluated suite. A separate set of nine deadlock-free programs checked whether the runtime WFG confused safe synchronization with an active cycle.

CategoryScenarioWhat it checks
Architecturalgate_guarded_fpHold-and-wait avoided by a coordinator
Architecturalproducer_consumer_fpUnidirectional shared-queue flow
Temporallock_free_interval_fpLong lock-free intervals and stale state
Temporallock_order_inversion_fpInversion serialized by an atomic signal
Hierarchyfour_hier_fpStrict global lock ordering
Hierarchythread_local_hierarchy_fpDisjoint per-group hierarchies
Hierarchycomplex_lock_order_fpCyclic history serialized by phase barriers
Semanticsread_dominated_fpSafe shared-read cycles
Semanticsconditional_locking_fpCommon coordinator lock

The active WFG produced zero reports across these nine safe patterns. The predictive lock-order graph flagged two patterns as potential risks, which is expected because it analyzes acquisition history rather than current waits. These are empirical results for the tested patterns, not a proof about every possible program.

Five representative safe-pattern workloads were also timed:

ScenarioPL+DDDXND
Conditional locking24.46 s24.86 s654.32 s
Thread-local hierarchy23.39 s24.15 s318.44 s
Read dominated1.69 s1.82 s19.30 s
Producer-consumer0.57 s0.62 s14.09 s
Four hierarchy0.62 s0.61 s11.73 s

Focused 1.1 no-regression check

The current 1.1-focused Criterion run used 30 samples, a one-second warmup, and a two-second measurement window on an Apple M1 Pro:

OperationMedian95% interval
Deloxide Mutex, uncontended9.12 ns9.07 to 9.22 ns
parking_lot Mutex, uncontended10.28 ns9.95 to 10.50 ns
Deloxide RwLock write, uncontended9.17 ns9.08 to 9.21 ns
Deloxide RwLock read, uncontended58.07 ns54.06 to 62.78 ns
Deloxide Mutex, two-thread handoff37.89 µs37.12 to 39.03 µs

The Mutex result is faster than the earlier Deloxide microbenchmark and the same-harness PL+DD point. The run is too short and narrow to support a general performance claim. Its purpose is to show that the latest correctness fixes did not introduce material default fast-path overhead.

Reproducing the evidence

The repository’s evaluation record contains the current commands, toolchain, commits, raw CSVs, and paired-seed controls.

Benchmark on the hardware, feature set, contention topology, and workload you plan to ship. Microbenchmarks establish mechanism cost; only the application can establish production impact.