Problem
After the assembly-memoization change, assemble_simulation returns Arc<CompiledSimulation> (a salsa-tracked memo). But compile_project_incremental (src/simlin-engine/src/db.rs) does (*arc).clone() to return an owned CompiledSimulation, preserving its public signature.
The big win lands: a no-op recompile correctly skips assembly (the memo is reused). But the call still deep-clones the entire CompiledSimulation -- the modules / offsets / cached_constant_info maps -- on every call, even when nothing changed.
Why it matters
The deep clone is pure overhead on the hot recompile path. Returning Arc<CompiledSimulation> to callers would drop even that clone. The downstream callers (libsimlin / pysimlin / cli) construct Vm::new by value, so threading the Arc through (or having Vm::new accept &CompiledSimulation / Arc<CompiledSimulation>) would eliminate the clone end-to-end.
Not a correctness issue
This is a performance follow-up only -- results are unaffected.
Components affected
src/simlin-engine/src/db.rs (compile_project_incremental)
- Callers constructing
Vm::new: libsimlin, pysimlin, simlin-cli
Severity
low / perf.
Context
Identified during the salsa-pipeline-cleanup refactor (the assembly-memoization change that introduced Arc<CompiledSimulation> from assemble_simulation).
Problem
After the assembly-memoization change,
assemble_simulationreturnsArc<CompiledSimulation>(a salsa-tracked memo). Butcompile_project_incremental(src/simlin-engine/src/db.rs) does(*arc).clone()to return an ownedCompiledSimulation, preserving its public signature.The big win lands: a no-op recompile correctly skips assembly (the memo is reused). But the call still deep-clones the entire
CompiledSimulation-- themodules/offsets/cached_constant_infomaps -- on every call, even when nothing changed.Why it matters
The deep clone is pure overhead on the hot recompile path. Returning
Arc<CompiledSimulation>to callers would drop even that clone. The downstream callers (libsimlin / pysimlin / cli) constructVm::newby value, so threading theArcthrough (or havingVm::newaccept&CompiledSimulation/Arc<CompiledSimulation>) would eliminate the clone end-to-end.Not a correctness issue
This is a performance follow-up only -- results are unaffected.
Components affected
src/simlin-engine/src/db.rs(compile_project_incremental)Vm::new: libsimlin, pysimlin, simlin-cliSeverity
low / perf.
Context
Identified during the salsa-pipeline-cleanup refactor (the assembly-memoization change that introduced
Arc<CompiledSimulation>fromassemble_simulation).