You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f13f84c
Browse filesBrowse the repository at this point in the historyBrowse files
perf: delta-encode case and decomposition mappings
The `code-points.mjs` of Case_Folding, Simple_Case_Mapping,
Special_Casing and Decomposition_Mapping stored the map as compressed
JSON `[from, to]` pairs. Mapped code points are almost always close to
their keys, so the map is now written as a stream of variable-length
integers using the same base64 scheme as `ranges.mjs`: per entry, the
zigzag-encoded difference between its key and the previous key, a count,
and the zigzag-encoded differences between consecutive mapped code
points. A count of 0 marks an entry mapping to a single code point, so
files mixing scalar and array values (e.g. Unicode 3.0.1 Case_Folding/E)
round-trip exactly. The stream is brotli-compressed as before and decoded
by the new `decode-mapping.mjs`; `decode-ranges.mjs` now also exports
`decodeDeltas` for it. All 1,699 maps across the 35 versions are
identical to the previous output, entry order included.
For Unicode 18.0.0, `Simple_Case_Mapping/Uppercase/code-points.mjs`
shrinks from 4.1 KB to 1.1 KB, and the package from 390 KB to 378 KB
packed (1.39 MB to 1.38 MB unpacked).
Assisted-By: Claude Fable 5.1
Issue: #109
codePointsFileContent=`import { brotliDecompressSync } from 'node:zlib';\n\nexport default ${brotliInline(codePoints)};\n`;
295
+
codePointsFileContent=`import { brotliDecompressSync } from 'node:zlib';\nimport decodeMapping from '../../decode-mapping.mjs';\n\nexport default decodeMapping(${brotliInlineBuffer(
296
+
encodeMapping(codePoints),
297
+
)}.toString());\n`;
262
298
// The symbols map is derived from the code points map at runtime
263
299
// rather than shipped as a second copy of the same data.
264
300
symbolsFileContent=`import codePoints from './code-points.mjs';\nimport mappingToSymbols from '../../mapping-to-symbols.mjs';\n\nexport default mappingToSymbols(codePoints);\n`;
0 commit comments