embedded3 PERF-3 P1-2: the flag test's centreline polyline cached per thread and time (the 41-point rebuild with four transcendental evaluations each ran per surface-velocity call, ~10^6 calls per step): table faces 1,620 -> 54 ms, impose 622 -> 12 ms, build_mask 898 -> 404 ms, rebuild block 6.9 -> 4.3 s per step at 11.6 M cells; slab CSV byte-identical; table sub-laps
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / CI Success (push) Blocked by required conditions
CI / Clippy Check (push) Failing after 4s
Performance Benchmarks / Run Benchmarks (push) Failing after 4s
CI / Build (ubuntu-latest) (push) Failing after 3s
CI / Format Check (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 5s
CI / Build CPU-Only (Explicit) (push) Failing after 1m33s
Documentation / Build API Documentation (push) Failing after 1m37s
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / CI Success (push) Blocked by required conditions
CI / Clippy Check (push) Failing after 4s
Performance Benchmarks / Run Benchmarks (push) Failing after 4s
CI / Build (ubuntu-latest) (push) Failing after 3s
CI / Format Check (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 5s
CI / Build CPU-Only (Explicit) (push) Failing after 1m33s
Documentation / Build API Documentation (push) Failing after 1m37s
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
d9a2752cb9
commit
845e0ae01a
@@ -82,15 +82,31 @@ fn amplitude() -> f64 {
|
||||
/// around the centreline polyline of `n` segments) and the centreline's
|
||||
/// transverse velocity at the closest point.
|
||||
fn flag_2d(x: f64, y: f64, t: f64) -> (f64, f64) {
|
||||
let n = 40;
|
||||
const N: usize = 40;
|
||||
// The centreline polyline at `t`, once per thread and time (PERF-3
|
||||
// P1-2): the solver asks for the surface velocity at ~10⁶ faces per
|
||||
// step and each call rebuilt the 41 points (four hyperbolic / trigonometric
|
||||
// evaluations each). Same arithmetic, same digits.
|
||||
thread_local! {
|
||||
static POLYLINE: std::cell::RefCell<(f64, [(f64, f64, f64); N + 1])> =
|
||||
const { std::cell::RefCell::new((f64::NAN, [(0.0, 0.0, 0.0); N + 1])) };
|
||||
}
|
||||
let pts = POLYLINE.with(|cell| {
|
||||
let mut c = cell.borrow_mut();
|
||||
if c.0.to_bits() != t.to_bits() {
|
||||
for (m, p) in c.1.iter_mut().enumerate() {
|
||||
let s = m as f64 / N as f64;
|
||||
let (d, v) = deflection(s, t);
|
||||
*p = (FLAG_X0 + s * FLAG_LEN, CY + d, v);
|
||||
}
|
||||
c.0 = t;
|
||||
}
|
||||
c.1
|
||||
});
|
||||
let mut best = f64::INFINITY;
|
||||
let mut v_best = 0.0;
|
||||
let point = |m: usize| {
|
||||
let s = m as f64 / n as f64;
|
||||
let (d, v) = deflection(s, t);
|
||||
(FLAG_X0 + s * FLAG_LEN, CY + d, v)
|
||||
};
|
||||
for m in 0..n {
|
||||
let point = |m: usize| pts[m];
|
||||
for m in 0..N {
|
||||
let (ax, ay, av) = point(m);
|
||||
let (bx, by, bv) = point(m + 1);
|
||||
let (ex, ey) = (bx - ax, by - ay);
|
||||
|
||||
Reference in New Issue
Block a user