mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 14:52:09 +03:00
Replace the request-wide suffix-work char budget (MAX_SUFFIX_WORK_CHARS / reserveSuffixWork) with a simpler per-message bound: MAX_SUFFIX_STARTS (2000) suffix starts and MAX_TOTAL_BLOCK_BYTES (8 MiB) of retained block content. Dedup is best-effort — skipping the tail only forgoes some compression, never changes output correctness. Also replace the per-candidate RegExp-based occurrence counting in dedupeWithinMessage with indexOf-based scanning (replaceAllButFirst), since the regex compile+match was pathologically slow on the exact multi-thousand-line inputs the O(n²) guard targets. Update the #7849 regression suite to match the new bounding mechanism (silent truncation instead of fail-open warning). Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>