mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Chains of global one-character replacements (the HTML-escape idiom) run as one scr_str_replace_chars call. It searched for the next match eight bytes at a time and started the search over after each replacement. It now reads 16-byte blocks with SSE2 or NEON (8-byte words elsewhere on little-endian hosts) and replaces every match of a block before reading the next one. The table of characters and replacements is kept for the next call with the same immortal operands, which are the literals the compiler passes, instead of being rebuilt from the replacement text on every call.