Parallel + Memoised Hot Loop
Detect lock contention before it silently erases thread-level speedup.
Observed Symptom
A pure memoised function is called inside a parallel loop. Throughput collapses because all workers serialize on a shared cache lock.
Advisor Diagnosis
x-advisor models the interaction of call frequency, lock cost, and worker count. It flags this as negative synergy even though each individual contract is valid.
Recommended Refactor
Lift shared precomputation outside the loop, switch to thread-local caches, or remove memoisation when hit locality is weak.
Preserve semantic intent while reducing interaction penalties so the generated program is both correct and structurally performant on real hardware.
