From c73415abefc4650e4c394d42db69ad582fb644c0 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sun, 1 Nov 2026 13:31:39 +0100 Subject: [PATCH] perf(anatomy): V1-2.2 skip arc spread sampling where unused Third security review LOW: the f32 spread of an arc is sampled only when an outline is drawn and under its vertex cap; the variants' extremes still join the bounds. --- crates/core/src/anatomy/path.rs | 7 ++++++- docs/development/RUST.md | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/core/src/anatomy/path.rs b/crates/core/src/anatomy/path.rs index 76d41446..14a3cc09 100644 --- a/crates/core/src/anatomy/path.rs +++ b/crates/core/src/anatomy/path.rs @@ -579,6 +579,11 @@ impl Pen { moved(0.0, 0.0, (more, same)), moved(0.0, 0.0, (same, more)), ]; + // The bounds need the extremes alone; an outline past its cap is refused anyway. + let sampled = self + .flat + .as_ref() + .is_some_and(|flat| !flat.outline.overflow); let mut spread = 0.0_f64; for variant in &variants { let other = Ellipse::through(from, variant); @@ -587,7 +592,7 @@ impl Pen { self.add(other.at(angle)); } } - for i in 0..=SPREAD_SAMPLES { + for i in (0..=SPREAD_SAMPLES).filter(|_| sampled) { let t = f64::from(i) / f64::from(SPREAD_SAMPLES); let here = ellipse.at(ellipse.start + ellipse.sweep * t); let there = other.at(other.start + other.sweep * t); diff --git a/docs/development/RUST.md b/docs/development/RUST.md index e3106cd1..904a8de5 100644 --- a/docs/development/RUST.md +++ b/docs/development/RUST.md @@ -4429,6 +4429,15 @@ arithmetic drift raised to `4 × 2⁻²³` of the radius. Bounds of every arc gr edge counts them). LOW kept, pre-existing, outside the diff: relative commands accumulate in the browser's `f32` current point; the worst aligned case (4 096 segments at the 256-span offset limit) drifts 6 % of the span, contrived. +Third security review, on `86dce16`: PASS, no MEDIUM. Both siblings refuse or match (an f32 browser model on ~300 000 +random arcs: no counterexample at 0.5 CSS px; worst under-cover 0.13 units on generic arcs, about 0.1 px of disc radius). +LOWs: the spread's sampling ran for bounds alone and past the vertex cap, now skipped there (`86dce16` → the next commit; +the variants' extremes still join the bounds); open, declared: a semicircle exactly tangent to a frame edge counts the +spread of its variants (a few thousandths of a unit), so a detail `view_box` cropped exactly to an arc's extreme is +refused as out of frame; the spread is an estimate (one ulp, one axis at a time, rotation not moved); a zero-width needle of +a refused flat arc may run past the frame as a hairline nothing fills; arcs cost about 6 µs each natively, bounded by +the 2 MiB document only (≈ 1.8 s for a document of nothing but arcs, in the author's own preview). + Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 29 killed, 2 equivalent: Z22 (the floor prune removed; a cell that cannot reach the floor never holds an accepted disc) and Z25 (a path without an outline accepted; unreachable). S1, S8 and F16 of the previous scripts, whose anchors moved, re-anchored and killed. Module 580 438 B gzip -9