diff --git a/.changeset/huge-hotels-ask.md b/.changeset/huge-hotels-ask.md deleted file mode 100644 index b67b733..0000000 --- a/.changeset/huge-hotels-ask.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"unicode-segmenter": patch ---- - -Removed pinned `graphemeSegments()` in the module scope to make all APIs able to be three-shaken properly. - -It was introduced when they all use `graphemeSegments()` as the core. But now they are all have their own loop. diff --git a/.changeset/smooth-dragons-notice.md b/.changeset/smooth-dragons-notice.md deleted file mode 100644 index 657e74c..0000000 --- a/.changeset/smooth-dragons-notice.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -"unicode-segmenter": patch ---- - -Optimize the hot loop based on a deep analysis of the V8 optimization chain. - -As the result, the bundle size, speed, and memory usage. All three axes are improved. See PR [#144](https://github.com/cometkim/unicode-segmenter/pull/144) for detailed explanation. - -- Bundle: −4.2% min+gzip, −3.9% min+brotli on `unicode-segmenter/grapheme` (2,453 → 2,351 gzip); −3.4% / −2.8% on the full entry -- Hermes bytecode: −20.6% (20,015 → 15,892 bytes), −18.6% gzipped -- Runtime (Node.js/V8, per benchmark case) - - `splitGraphemes()` 1.5–2.2x, `countGraphemes()` 1.20–1.43x, `graphemeSegments()` 1.05–1.21x, `collectGraphemes()` 1.01–1.19x. - - Bun/JSC gains are larger, and the interpreter tiers (Hermes, QuickJS) improve 5–23% -- Memory: lookup tables 20.6 kB → 19.1 kB, retained heap 228 kB → 218 kB, module init 1.7 ms → 1.5 ms - -The state compaction strategy is the major part. It is valid across all optimization tiers of the V8 runtime (Jitless, Maglev, TurboFan) and has been consistently improved across all other engines. - -Another noticeable change is `splitGraphemes()`, it now owns its loop, just like `countGraphemes()`. -It produces a 30-60% performance improvement. The size increase is roughly free after compression, since the fourth byte-aligned copy of the loop back-references the other three. And the uncompressed size is amortized by other improvements. - -All the analysis have done by Claude Opus 5, well-done! diff --git a/CHANGELOG.md b/CHANGELOG.md index 51c1ba8..c8fe5e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # unicode-segmenter +## 0.17.2 + +### Patch Changes + +- 7374446: Removed pinned `graphemeSegments()` in the module scope to make all APIs able to be three-shaken properly. + + It was introduced when they all use `graphemeSegments()` as the core. But now they are all have their own loop. + +- 957898b: Optimize the hot loop based on a deep analysis of the V8 optimization chain. + + As the result, the bundle size, speed, and memory usage. All three axes are improved. See PR [#144](https://github.com/cometkim/unicode-segmenter/pull/144) for detailed explanation. + + - Bundle: −4.2% min+gzip, −3.9% min+brotli on `unicode-segmenter/grapheme` (2,453 → 2,351 gzip); −3.4% / −2.8% on the full entry + - Hermes bytecode: −20.6% (20,015 → 15,892 bytes), −18.6% gzipped + - Runtime (Node.js/V8, per benchmark case) + - `splitGraphemes()` 1.5–2.2x, `countGraphemes()` 1.20–1.43x, `graphemeSegments()` 1.05–1.21x, `collectGraphemes()` 1.01–1.19x. + - Bun/JSC gains are larger, and the interpreter tiers (Hermes, QuickJS) improve 5–23% + - Memory: lookup tables 20.6 kB → 19.1 kB, retained heap 228 kB → 218 kB, module init 1.7 ms → 1.5 ms + + The state compaction strategy is the major part. It is valid across all optimization tiers of the V8 runtime (Jitless, Maglev, TurboFan) and has been consistently improved across all other engines. + + Another noticeable change is `splitGraphemes()`, it now owns its loop, just like `countGraphemes()`. + It produces a 30-60% performance improvement. The size increase is roughly free after compression, since the fourth byte-aligned copy of the loop back-references the other three. And the uncompressed size is amortized by other improvements. + + All the analysis have done by Claude Opus 5, well-done! + ## 0.17.1 ### Patch Changes diff --git a/package.json b/package.json index 36cea10..3510160 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unicode-segmenter", - "version": "0.17.1", + "version": "0.17.2", "type": "module", "description": "A lightweight implementation of the Unicode Text Segmentation (UAX #29)", "license": "MIT",