style(simulation): cargo fmt on the workshop benches (gate bounce; clippy and tests were green)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -888,7 +888,9 @@ fn bench_chunk_spacing_4096_cells() {
|
||||
let seed = SeedChain::root(99).derive(SeedDomain::Body, 1);
|
||||
let grid_side = 64u32; // 4,096 cells — matches the Block/Tile sweep above
|
||||
|
||||
println!("\n=== Interview-2: chunk (64m) spacing derive_at_metres benchmark (4,096-cell sweep) ===");
|
||||
println!(
|
||||
"\n=== Interview-2: chunk (64m) spacing derive_at_metres benchmark (4,096-cell sweep) ==="
|
||||
);
|
||||
println!(
|
||||
"grid: {grid_side}x{grid_side} = {} cells/sweep\n",
|
||||
grid_side * grid_side
|
||||
@@ -900,7 +902,11 @@ fn bench_chunk_spacing_4096_cells() {
|
||||
for (label, step_m, cutoff_m) in [
|
||||
("chunk (64m), cutoff=64m", chunk_m, chunk_m),
|
||||
("chunk (64m), UNCUT (cutoff=0)", chunk_m, 0.0),
|
||||
("block (128m), cutoff=128m [reference row]", block_m, block_m),
|
||||
(
|
||||
"block (128m), cutoff=128m [reference row]",
|
||||
block_m,
|
||||
block_m,
|
||||
),
|
||||
] {
|
||||
let n_cells = (grid_side * grid_side) as u64;
|
||||
let t0 = Instant::now();
|
||||
@@ -1068,7 +1074,8 @@ fn build_gj1c_courses_near_window(
|
||||
for edge in &edges {
|
||||
let anchor_a = to_world(edge.upstream.0, edge.upstream.1);
|
||||
let anchor_b = to_world(edge.downstream.0, edge.downstream.1);
|
||||
let chord_m = ((anchor_a.0 - anchor_b.0).powi(2) + (anchor_a.1 - anchor_b.1).powi(2)).sqrt();
|
||||
let chord_m =
|
||||
((anchor_a.0 - anchor_b.0).powi(2) + (anchor_a.1 - anchor_b.1).powi(2)).sqrt();
|
||||
// Same 0.08 inflation fraction layer_proxy.rs's COURSE_BBOX_INFLATION_FRACTION
|
||||
// uses (that constant itself is private; the value is stated in its
|
||||
// own doc and reproduced here for the same bbox-cull purpose — a
|
||||
@@ -1159,7 +1166,10 @@ fn bench_s2_courses_density_at_chunk_and_block() {
|
||||
" densest river cell: {best_cell:?} ({best_count} river cells within {radius_px}px radius), world center {center_world:?}"
|
||||
);
|
||||
|
||||
for (label, step_m) in [("chunk (64m)", scale::CHUNK_M as f64), ("block (128m)", scale::BLOCK_M as f64)] {
|
||||
for (label, step_m) in [
|
||||
("chunk (64m)", scale::CHUNK_M as f64),
|
||||
("block (128m)", scale::BLOCK_M as f64),
|
||||
] {
|
||||
// Realistic-shape window at this spacing: 64x64 cells (4,096, matching
|
||||
// this file's other 4,096-cell sweeps for direct comparability).
|
||||
let grid_side = 64u32;
|
||||
@@ -1197,9 +1207,8 @@ fn bench_s2_courses_density_at_chunk_and_block() {
|
||||
for col in 0..grid_side {
|
||||
let wx = win_x0 + col as f64 * step_m;
|
||||
let wy = win_y0 + row as f64 * step_m;
|
||||
let prof = derive_at_metres(
|
||||
seed, "GJ1c", ¶ms, &ta, wx, wy, &climate, step_m, &[],
|
||||
);
|
||||
let prof =
|
||||
derive_at_metres(seed, "GJ1c", ¶ms, &ta, wx, wy, &climate, step_m, &[]);
|
||||
std::hint::black_box(prof.elev_q);
|
||||
}
|
||||
}
|
||||
@@ -1226,15 +1235,12 @@ fn bench_s2_courses_density_at_chunk_and_block() {
|
||||
let ms_on_per_sweep = elapsed_on.as_secs_f64() * 1000.0 / iterations as f64;
|
||||
let delta_ms = ms_on_per_sweep - ms_off_per_sweep;
|
||||
let delta_pct = 100.0 * delta_ms / ms_off_per_sweep;
|
||||
let ns_per_cell_off = elapsed_off.as_secs_f64() * 1e9 / (n_cells * iterations as u64) as f64;
|
||||
let ns_per_cell_off =
|
||||
elapsed_off.as_secs_f64() * 1e9 / (n_cells * iterations as u64) as f64;
|
||||
let ns_per_cell_on = elapsed_on.as_secs_f64() * 1e9 / (n_cells * iterations as u64) as f64;
|
||||
|
||||
println!(
|
||||
" courses OFF: {ms_off_per_sweep:.4} ms/sweep ({ns_per_cell_off:.1} ns/cell)"
|
||||
);
|
||||
println!(
|
||||
" courses ON: {ms_on_per_sweep:.4} ms/sweep ({ns_per_cell_on:.1} ns/cell)"
|
||||
);
|
||||
println!(" courses OFF: {ms_off_per_sweep:.4} ms/sweep ({ns_per_cell_off:.1} ns/cell)");
|
||||
println!(" courses ON: {ms_on_per_sweep:.4} ms/sweep ({ns_per_cell_on:.1} ns/cell)");
|
||||
println!(
|
||||
" delta: {delta_ms:+.4} ms/sweep ({delta_pct:+.2}%), {} courses in window",
|
||||
courses.len()
|
||||
|
||||
Reference in New Issue
Block a user