core/algebra
Shay e36998d25d perf(rust): zero-copy vault_recall — Rust beats Python at scale
ADR-0020 follow-on (task #35). Two-pronged fix:

1. Kernel: ported ADR-0019 Stage 1 diagonal-metric kernel to
   core-rs/src/vault.rs. Per-versor scoring is now 32 multiplies
   + 32 adds via the precomputed Cl(4,1) metric, not the
   1024-op full geometric_product the prior path computed.
   Bit-identity preserved by serial fold order matching Python.

2. Zero-copy marshalling: replaced Vec<&PyAny> + extract-per-
   versor with PyReadonlyArray2<f32> via the numpy Rust crate.
   The Rust binding now reads a slice view directly into the
   numpy buffer — no Python→Rust copy, no Vec<[f32;32]>
   re-chunk. Python caller passes the (N, 32) ndarray as-is
   (ascontiguousarray ensures C-contiguous f32).

Result:
  N      python   rust    speedup
  1k     0.20ms   0.26ms  0.77x  (Python wins on fixed overhead)
  10k    1.62ms   1.45ms  1.12x
  100k   19.22ms  12.93ms 1.49x
  1M     251.50ms 131.36ms 1.91x

Parity bit-identical (raw f32 bytes) at every scale across the
parameterised test in tests/test_vault_recall_rust_parity.py.

Both ADR-0020 first-surface gates now pass: parity AND
performance at the scales where Rust is meant to win. Python
remains the default per CLAUDE.md sequencing rule 5;
CORE_BACKEND=rust is now a legitimate opt-in acceleration.

Smoke 27/27, algebra 70/70, runtime 19/19 all green.
2026-05-16 17:25:41 -07:00
..
__init__.py arch: close coordinate back-door in vocab layer 2026-05-12 20:52:14 -07:00
backend.py perf(rust): zero-copy vault_recall — Rust beats Python at scale 2026-05-16 17:25:41 -07:00
cga.py Fix fail-closed versor construction 2026-05-14 12:13:04 -07:00
cl41.py Fix fail-closed versor construction 2026-05-14 12:13:04 -07:00
holonomy.py Fix test suite errors across core physics and generation 2026-05-14 13:02:32 -07:00
rotor.py fix(drift): proper rotor-manifold scaling; restore respond contract 2026-05-16 11:44:45 -07:00
versor.py fix(algebra): enforce strict runtime closure after unitize 2026-05-15 23:23:11 -07:00