docs/solutions/performance-issues/2026-04-03-nodeid-paste-import-needs-insertfragment-benchmark.md
insertFragment benchmarkNodeIdPlugin already had a clean init-time story, but the expensive real-world
path for copy/paste and import lives inside withNodeId during fragment
insertion. The existing init-dissection lane did not touch that path.
That meant we could keep shaving the wrong seam and still have no honest answer
about whether withNodeId deserved more surgery.
init-dissection only timed construction, initialization, and pure
normalizeNodeId(...).withNodeId insert path still had no dedicated benchmark lane.nodeId numbers as a proxy for paste/import cost. They are
not the same path.withNodeId rewrites before measuring duplicate-id paste
directly.Add a dedicated nodeid-fragment benchmark lane to
/dev/editor-perf.
The new lane times real editor.tf.insertFragment(...) work for four cases:
It also records the counters that actually explain the cost:
insert_node operation countThe fragment builder intentionally separates two shapes:
The focused helper/spec lives in:
It measures the real seam instead of a neighboring seam.
The first live 5k run on http://localhost:3020/dev/editor-perf with a
200-block fragment showed:
5.32 ms5.87 ms5.54 ms20.06 msThat means:
0.55 ms
for 199 assigned ids199 duplicate lookups cost about 13.89 ms,
which explains almost all of the extra runtimeSo the benchmark changed the conclusion:
withNodeId work if you are targeting duplicate lookup cost