Found during PR #28's round-4 review, independent of that PR (reproduces on main).
bodyHtml()'s paragraph soft-join flattens the accumulated string on every line (joined.slice(-1) on a growing rope), so a single long paragraph — plain words, no comment syntax at all — renders in time quadratic in its size: about 540 ms for 512 KiB on main, and shapes like --> line\n repeated behave the same way.
Fix: accumulate lines in an array and join once per paragraph (or track only the last character separately). Add a linearity test in the ratio form used by site-core.test.js (256 KiB → 1 MiB ratio ≤ ~5×), not a fixed millisecond bound, since those are load-flaky.
Found during PR #28's round-4 review, independent of that PR (reproduces on
main).bodyHtml()'s paragraph soft-join flattens the accumulated string on every line (joined.slice(-1)on a growing rope), so a single long paragraph — plain words, no comment syntax at all — renders in time quadratic in its size: about 540 ms for 512 KiB onmain, and shapes like--> line\nrepeated behave the same way.Fix: accumulate lines in an array and join once per paragraph (or track only the last character separately). Add a linearity test in the ratio form used by
site-core.test.js(256 KiB → 1 MiB ratio ≤ ~5×), not a fixed millisecond bound, since those are load-flaky.