Skip to content

Commit 61499dd

Browse files
committed
rmg-core: scheduler pedantic lint cleanup (no logic changes)
- Add doc backticks for /, . - Split into helpers (too_many_lines) without changing behavior. - Tests: move helper above statements; remove println!/unwrap!; capture fmt args. - Benches: tidy reserve_scaling placeholder imports/param name. - Docs Guard: update execution-plan + decision-log; regenerate echo-total. Determinism and invariants preserved; no algorithmic or ordering changes.
1 parent b29f168 commit 61499dd

File tree

5 files changed

+1714
-38
lines changed

5 files changed

+1714
-38
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#![allow(missing_docs)]
2+
//! Benchmark: reserve() scaling with footprint size and number of reserved rewrites
3+
//!
4+
//! Measures how reserve() performance scales with:
5+
//! 1. Number of previously reserved rewrites (k)
6+
//! 2. Size of footprint being reserved (m)
7+
//!
8+
//! The current GenSet-based implementation should scale as O(m), independent of k.
9+
//! A naive Vec<Footprint> implementation would scale as O(k × m).
10+
11+
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
12+
use rmg_core::Hash;
13+
use std::time::Duration;
14+
15+
// Import the scheduler - it's crate-private so we can't access it directly
16+
// Instead we'll use it through the Engine API
17+
// Actually, we need direct access for this micro-benchmark, so we'll create
18+
// a test module inside rmg-core and expose it via a feature flag or just
19+
// write an integration test instead.
20+
21+
// For now, let's write a simpler benchmark that measures reserve through the Engine API
22+
23+
fn make_hash(val: u8) -> Hash {
24+
let mut h = [0u8; 32];
25+
h[0] = val;
26+
h
27+
}
28+
29+
// Note: This benchmark requires access to DeterministicScheduler which is crate-private.
30+
// Moving this to rmg-core/src/scheduler.rs tests module or using a pub(crate) test harness.
31+
32+
fn bench_reserve_scaling(_c: &mut Criterion) {
33+
// This is a placeholder - the actual benchmark needs to be in rmg-core
34+
// where we can access the scheduler directly.
35+
36+
// TODO: Implement this properly by either:
37+
// 1. Adding a test-only public API to DeterministicScheduler
38+
// 2. Moving this benchmark into rmg-core as a test module
39+
// 3. Using Engine API indirectly (less precise)
40+
41+
let _ = (
42+
BenchmarkId::new("placeholder", "reserve_scaling"),
43+
Throughput::Elements(1),
44+
make_hash(0),
45+
);
46+
}
47+
48+
criterion_group! {
49+
name = benches;
50+
config = Criterion::default()
51+
.warm_up_time(Duration::from_secs(1))
52+
.measurement_time(Duration::from_secs(5))
53+
.sample_size(50);
54+
targets = bench_reserve_scaling
55+
}
56+
criterion_main!(benches);

0 commit comments

Comments
 (0)