cProfile attribution (2026-05-21) identified
``core.physics.salience.SalienceOperator.compute`` as 64% of total
``ChatRuntime.chat()`` time. Pre-fix it was a nested Python loop
over ``regions × regions`` with one ``np.linalg.norm`` call per
pair. For N≈500 mounted-vocab regions per turn that meant ~250k
norm calls per turn, dominating end-to-end latency.
Fix: numpy broadcast for pairwise displacement, distance,
pressure-delta, and contribution. Same math; same contract.
ULP-level reassociation drift is absorbed by the 12-decimal
precision ``_salience_address`` already used for content
addressing, and by the float32 conversion at the downstream
``SalienceMap.scores_arr`` site, so neither the content_address
nor the top-k ordering changes.
Measurements (region set: N=493, dim=5, seeded):
vectorized: 11.78 ms/call
old-loop: 672.30 ms/call
speedup: 57.1×
End-to-end on 8 cognition-shape prompts:
pre-fix: ~970 ms/turn
post-fix: 565 ms/turn (-42%)
Validation:
* 15 new tests in ``tests/test_salience_vectorize_parity.py``:
- parity with a nested-loop reference to 1e-9 absolute on
curvature_magnitude, gradient_vector, influence_radius
across N ∈ {1, 2, 8, 32, 128, 493}
- content_address byte-identical across N ∈ {1, 8, 32, 128}
- top-16 ordering matches the reference at N ∈ {32, 128, 493}
- empty regions returns empty map
- single region has zero curvature
* ``core eval cognition`` byte-identical: public 100/100/91.7/100.
* ``core test --suite cognition`` 120/0/1, ``smoke`` 67/0.
The file's pre-existing docstring promised a Rust path
(``core_rs::physics::salience::compute_curvature``) that does not
yet exist — the numpy vectorization realizes the lift now while
keeping the Rust port a future optimization on stable semantics
(CLAUDE.md: "Rust backend parity only after Python semantics are
locked by tests").