You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Profiling make paper showed docs/paper/reductions.typ took ~27 s to compile. Two hot spots:
load-example / load-model-example doing O(n²) linear scans over data/examples.json (228 rules + 193 models, 279 call sites).
find-edge / get-reductions-to / get-reductions-from / render-complexity re-scanning reduction_graph.json edges and resolving nodes.at(e.source).name on every call.
Done so far
Pre-indexed example-db into _rules-index / _models-index dicts keyed by "src->tgt" / problem name. Bucketed lookup + small filter on variant (docs/paper/reductions.typ:17-72).
Pre-indexed graph-data: _graph-edges-resolved (source/target name resolved once), _edges-by-source-name, _edges-by-target-name, _edge-by-pair, _nodes-by-name. Rewrote find-edge, get-reductions-to/from, render-complexity to use them.
Result: 27 s → ~9.7 s (≈2.8×).
Remaining work
Verify PDF output is identical. Compare old vs new reductions.pdf — check page count, figure placement, example renderings, completeness warnings. No semantic regressions.
Context
Profiling
make papershoweddocs/paper/reductions.typtook ~27 s to compile. Two hot spots:load-example/load-model-exampledoing O(n²) linear scans overdata/examples.json(228 rules + 193 models, 279 call sites).find-edge/get-reductions-to/get-reductions-from/render-complexityre-scanningreduction_graph.jsonedges and resolvingnodes.at(e.source).nameon every call.Done so far
example-dbinto_rules-index/_models-indexdicts keyed by"src->tgt"/ problem name. Bucketed lookup + small filter on variant (docs/paper/reductions.typ:17-72).graph-data:_graph-edges-resolved(source/target name resolved once),_edges-by-source-name,_edges-by-target-name,_edge-by-pair,_nodes-by-name. Rewrotefind-edge,get-reductions-to/from,render-complexityto use them.Result: 27 s → ~9.7 s (≈2.8×).
Remaining work
reductions.pdf— check page count, figure placement, example renderings, completeness warnings. No semantic regressions.examples.json(currently 19 MB).rule.solutions[].target_configis 91 % of the file; 26 MB of that comes from a single rule (tracked in KSatisfiability → TimetableDesign reduction: gadget blowup 64·L² seems excessive #1036). Once KSatisfiability → TimetableDesign reduction: gadget blowup 64·L² seems excessive #1036 lands, regenerate the fixture and re-measure.target_configastarget_config_ones: [indices]in the export script, update ~12 call sites inreductions.typ. Expected: 19 MB → ~1.5 MB, compile ~3–4 s.main.Files touched
docs/paper/reductions.typ(indexing helpers + rewritten lookup functions)Definition of done
make papercompiles in ≤ 5 s on a warm cache.reductions.pdfvisually matches the pre-optimization version (spot check + page count).mainwith a short commit message explaining the indexing pattern.Related