Skip to content

utf8 columns: unescape strings straight into the column - #2

Merged
lemire merged 1 commit into
mainfrom
unescape_in_place
Nov 11, 2026
Merged

lemire merged 1 commit into
mainfrom
unescape_in_place

Conversation

@lemire

@lemire lemire commented Nov 11, 2026

Copy link
Copy Markdown
Member

get_string() unescaped each string into the parser's string buffer, then we copied it into the column. We now unescape it in place with parser::unescape(): the result is no longer than the token, and we reserve SIMDJSON_PADDING more bytes for the unescaper. The idea comes from simdjson/simdjson#3050. Error messages are unchanged.

bench_ndjson, one thread, best of 3 interleaved rounds, simdjson 5.1.1, GB/s:

case Apple M4 (Apple clang) Xeon Gold 6548N, GCC 16 Xeon Gold 6548N, clang 21
flat, validation 1.13 → 1.33 (+18%) 0.735 → 0.777 (+5.7%) 0.725 → 0.764 (+5.4%)
gharchive, inferred schema 0.62 → 0.67 (+7%) 0.340 → 0.361 (+6.2%) 0.347 → 0.365 (+5.2%)
gharchive, gh schema, validation 3.74 → 3.91 (+4.6%) 1.967 → 1.992 (+1.3%) 1.922 → 1.941 (+1.0%)
gharchive, gh schema, no validation 5.65 → 5.64 (0%) 3.005 → 3.134 (+4.3%) 3.133 → 3.193 (+1.9%)

Tests pass (Apple clang, GCC 16, clang 21), as do the fastpysimdjson tests with this file vendored; ASan and UBSan are clean.

get_string() unescaped each string into the parser's string buffer, then we
copied it into the column. We now unescape it in place: the result is no
longer than the token, and we reserve SIMDJSON_PADDING more bytes for the
unescaper.
@lemire
lemire merged commit 7d5a071 into main Nov 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant