Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Since [Hermes doesn't support the `Intl.Segmenter` API](https://github.com/faceb

| Name | Unicode® | ESM? | Size | Size (min) | Size (min+gzip) | Size (min+br) | Size (min+zstd) |
|------------------------------|----------|------|----------:|-----------:|----------------:|--------------:|----------------:|
| `unicode-segmenter/grapheme` | 16.0.0 | ✔️ | 15,921 | 12,189 | 5,060 | 3,773 | 4,746 |
| `unicode-segmenter/grapheme` | 16.0.0 | ✔️ | 15,922 | 12,188 | 5,057 | 3,770 | 4,745 |
| `graphemer` | 15.0.0 | ✖️ ️| 410,435 | 95,104 | 15,752 | 10,660 | 15,911 |
| `grapheme-splitter` | 10.0.0 | ✖️ | 122,252 | 23,680 | 7,852 | 4,841 | 6,750 |
| `@formatjs/intl-segmenter`* | 15.0.0 | ✖️ | 603,285 | 369,560 | 72,218 | 49,416 | 67,975 |
Expand All @@ -236,7 +236,7 @@ Since [Hermes doesn't support the `Intl.Segmenter` API](https://github.com/faceb

| Name | Bytecode size | Bytecode size (gzip)* |
|------------------------------|--------------:|----------------------:|
| `unicode-segmenter/grapheme` | 20,928 | 10,973 |
| `unicode-segmenter/grapheme` | 20,936 | 10,980 |
| `graphemer` | 133,978 | 31,713 |
| `grapheme-splitter` | 63,835 | 19,137 |

Expand Down
6 changes: 1 addition & 5 deletions src/grapheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ export function* graphemeSegments(input) {
let index = 0;

while (true) {
// @ts-ignore
// Note:
// Using `!` and implicit conversion for brotli compression ratio.
// Even a small change like `+` or `>=` here will increase the size.
cursor += !(cp < 0xFFFF) + 1;
cursor += cp < 0xFFFF ? 1 : 2;

// Note: Of course the nullish coalescing is useful here,
// but avoid it for aggressive compatibility and perf claim
Expand Down