Graph Layout Profiling Plan
Goal: reduce graph node movement cost during force layout and drag by avoiding unnecessary label work and coalescing point updates.
Scope
- Graph view layout/update:
assets/lua/graph/view/init.fnl,assets/lua/graph/view/layout.fnl - Labels:
assets/lua/graph/view/labels.fnl - Layered points:
assets/lua/layered-point.fnl,assets/lua/points.fnl - Movables glue:
assets/lua/graph/view/movables.fnl
Plan
Stop rebuilding labels every tick during drag.
- Add drag start/end hooks from
GraphViewMovablestoGraphView. - During drag, skip label updates and refreshes; on drag end, refresh labels once for moved nodes.
- Add drag start/end hooks from
Coalesce point updates for layered points.
- Update
LayeredPoint.set-position-valuesto avoidglm.vec3allocation and call per-layerset-position-valuesdirectly. - Add a fast path to
LayeredPoint.set-position/apply-positionto reuse the new per-component update. - Ensure
GraphView.set-point-positionuses the per-component path to reduce Lua->C++ overhead.
- Update
Keep force-layout behavior unchanged.
- Do not reduce update frequency or iteration count.
Validation
- Re-run
make prof target=graph-layout args="--skip-images"and compare flamegraph hotspots. - Spot-check drag updates for label correctness (labels snap to new position after drag end).
