Fixing Ill‐Formed UTF ‐16 Strings With SIMD Instructions

ABSTRACT Background We must fix ill‐formed UTF‐16 strings, where surrogate pairs are mismatched. Programming languages such as JavaScript provide functions that replace mismatched surrogates with the Unicode replacement character (U + FFFD). Objectives We seek to accelerate the correction of ill‐formed UTF‐16 strings. Methods We propose using Single Instruction, Multiple Data (SIMD) instructions to handle multiple code units in parallel, enabling faster and more efficient execution. We provide implementations for ARM NEON and x64 (SSE, AVX2, AVX‐512). Results Our implementations reach 18.9 GB/s on an Apple M4 processor and 7.5 GB/s on an Intel Ice Lake processor—up to nine times faster than the scalar baseline of the V8 JavaScript engine—while requiring as little as 0.4 instructions per byte. Integrated into Node.js, our functions make the toWellFormed JavaScript function about five times faster. Conclusions Our algorithm achieves significant performance improvements over conventional methods. Our software is part of the Google JavaScript engine (V8) and thus part of several major Web browsers.

Authors

Institutions

Publication Details

Journal
Software Practice and Experience
Published
2026-08-25
DOI
https://doi.org/10.1002/spe.70105
Primary Topic
Advanced Wireless Communication Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Fixing Ill‐Formed UTF ‐16 Strings With SIMD Instructions

Robert Clausecker, Daniel Lemire
Software Practice and Experience
Advanced Wireless Communication Techniques
article

Fixing Ill‐Formed UTF ‐16 Strings With SIMD Instructions

Robert Clausecker, Daniel Lemire
article en

Abstract

ABSTRACT Background We must fix ill‐formed UTF‐16 strings, where surrogate pairs are mismatched. Programming languages such as JavaScript provide functions that replace mismatched surrogates with the Unicode replacement character (U + FFFD). Objectives We seek to accelerate the correction of ill‐formed UTF‐16 strings. Methods We propose using Single Instruction, Multiple Data (SIMD) instructions to handle multiple code units in parallel, enabling faster and more efficient execution. We provide implementations for ARM NEON and x64 (SSE, AVX2, AVX‐512). Results Our implementations reach 18.9 GB/s on an Apple M4 processor and 7.5 GB/s on an Intel Ice Lake processor—up to nine times faster than the scalar baseline of the V8 JavaScript engine—while requiring as little as 0.4 instructions per byte. Integrated into Node.js, our functions make the toWellFormed JavaScript function about five times faster. Conclusions Our algorithm achieves significant performance improvements over conventional methods. Our software is part of the Google JavaScript engine (V8) and thus part of several major Web browsers.

Software Practice and Experience
Université du Québec à Montréal (CA), Zuse Institute Berlin (DE), Université TÉLUQ (CA)
Openalex Percentile: Top 100%
Advanced Wireless Communication Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.