mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-02 07:43:42 +08:00
charCodeAt on a non-ASCII string mapped the UTF-16 index to a byte offset through a string index entry, which the first read claimed and the string's release purged. For a string of one character, such as each character of a for-of loop that codePointAt(0) classifies, the entry cost more than the read. A non-ASCII receiver of up to 16 bytes is now decoded from its start on each read, as scr_str_utf16_len already counts short receivers. Longer receivers keep the index entry and its cursor.