diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 84 |
1 files changed, 42 insertions, 42 deletions
| @@ -154,7 +154,7 @@ In your code: | |||
| 154 | ```zig | 154 | ```zig |
| 155 | const GeneralCategories = @import("GeneralCategories"); | 155 | const GeneralCategories = @import("GeneralCategories"); |
| 156 | 156 | ||
| 157 | test "General Category" { | 157 | test "General Categories" { |
| 158 | const gen_cat = try GeneralCategories.init(allocator); | 158 | const gen_cat = try GeneralCategories.init(allocator); |
| 159 | defer gen_cat.deinit(allocator); | 159 | defer gen_cat.deinit(allocator); |
| 160 | 160 | ||
| @@ -246,7 +246,7 @@ In your code: | |||
| 246 | ```zig | 246 | ```zig |
| 247 | const LetterCasing = @import("LetterCasing"); | 247 | const LetterCasing = @import("LetterCasing"); |
| 248 | 248 | ||
| 249 | test "Case" { | 249 | test "LetterCasing" { |
| 250 | const case = try LetterCasing.init(allocator); | 250 | const case = try LetterCasing.init(allocator); |
| 251 | defer case.deinit(allocator); | 251 | defer case.deinit(allocator); |
| 252 | 252 | ||
| @@ -309,7 +309,7 @@ In your code: | |||
| 309 | ```zig | 309 | ```zig |
| 310 | const Normalize = @import("Normalize"); | 310 | const Normalize = @import("Normalize"); |
| 311 | 311 | ||
| 312 | test "Normalization" { | 312 | test "Normalize" { |
| 313 | const normalize = try Normalize.init(allocator); | 313 | const normalize = try Normalize.init(allocator); |
| 314 | defer normalize.deinit(allocator); | 314 | defer normalize.deinit(allocator); |
| 315 | 315 | ||
| @@ -377,15 +377,15 @@ test "Caseless matching" { | |||
| 377 | // matching because it decomposes fully to NFKD. | 377 | // matching because it decomposes fully to NFKD. |
| 378 | const a = "Héllo World! \u{3d3}"; | 378 | const a = "Héllo World! \u{3d3}"; |
| 379 | const b = "He\u{301}llo World! \u{3a5}\u{301}"; | 379 | const b = "He\u{301}llo World! \u{3a5}\u{301}"; |
| 380 | try expect(try case_fold.compatCaselessMatch(allocator, &n, a, b)); | 380 | try expect(try case_fold.compatCaselessMatch(allocator, a, b)); |
| 381 | 381 | ||
| 382 | const c = "He\u{301}llo World! \u{3d2}\u{301}"; | 382 | const c = "He\u{301}llo World! \u{3d2}\u{301}"; |
| 383 | try expect(try case_fold.compatCaselessMatch(allocator, &n, a, c)); | 383 | try expect(try case_fold.compatCaselessMatch(allocator, a, c)); |
| 384 | 384 | ||
| 385 | // `canonCaselessMatch` isn't as comprehensive as `compatCaselessMatch` | 385 | // `canonCaselessMatch` isn't as comprehensive as `compatCaselessMatch` |
| 386 | // because it only decomposes to NFD. Naturally, it's faster because of this. | 386 | // because it only decomposes to NFD. Naturally, it's faster because of this. |
| 387 | try expect(!try case_fold.canonCaselessMatch(allocator, &n, a, b)); | 387 | try expect(!try case_fold.canonCaselessMatch(allocator, a, b)); |
| 388 | try expect(try case_fold.canonCaselessMatch(allocator, &n, a, c)); | 388 | try expect(try case_fold.canonCaselessMatch(allocator, a, c)); |
| 389 | } | 389 | } |
| 390 | ``` | 390 | ``` |
| 391 | Case folding needs to use the `Normalize` module in order to produce the compatibility | 391 | Case folding needs to use the `Normalize` module in order to produce the compatibility |
| @@ -536,61 +536,61 @@ Benchmarks demonstrate the above stated goals have been met: | |||
| 536 | ```plain | 536 | ```plain |
| 537 | Binary sizes ======= | 537 | Binary sizes ======= |
| 538 | 538 | ||
| 539 | 149K ziglyph_case | 539 | 172K ziglyph_case |
| 540 | 87K zg_case | 540 | 109K zg_case |
| 541 | 541 | ||
| 542 | 275K ziglyph_caseless | 542 | 299K ziglyph_caseless |
| 543 | 168K zg_caseless | 543 | 175K zg_caseless |
| 544 | 544 | ||
| 545 | 68K ziglyph_codepoint | 545 | 91K ziglyph_codepoint |
| 546 | 68K zg_codepoint | 546 | 91K zg_codepoint |
| 547 | 547 | ||
| 548 | 101K ziglyph_grapheme | 548 | 108K ziglyph_grapheme |
| 549 | 86K zg_grapheme | 549 | 109K zg_grapheme |
| 550 | 550 | ||
| 551 | 185K ziglyph_normalizer | 551 | 208K ziglyph_normalizer |
| 552 | 152K zg_normalize | 552 | 175K zg_normalize |
| 553 | 553 | ||
| 554 | 101K ziglyph_width | 554 | 124K ziglyph_width |
| 555 | 86K zg_width | 555 | 109K zg_width |
| 556 | 556 | ||
| 557 | Benchmarks ========== | 557 | Benchmarks ========== |
| 558 | 558 | ||
| 559 | Ziglyph toUpperStr/toLowerStr: result: 7911596, took: 80 | 559 | Ziglyph toUpperStr/toLowerStr: result: 7756580, took: 74 |
| 560 | Ziglyph isUpperStr/isLowerStr: result: 110959, took: 17 | 560 | Ziglyph isUpperStr/isLowerStr: result: 110959, took: 17 |
| 561 | zg toUpperStr/toLowerStr: result: 7911596, took: 62 | 561 | zg toUpperStr/toLowerStr: result: 7756580, took: 58 |
| 562 | zg isUpperStr/isLowerStr: result: 110959, took: 7 | 562 | zg isUpperStr/isLowerStr: result: 110959, took: 11 |
| 563 | 563 | ||
| 564 | Ziglyph Normalizer.eqlCaseless: result: 625, took: 500 | 564 | Ziglyph Normalizer.eqlCaseless: result: 626, took: 479 |
| 565 | zg CaseFold.canonCaselessMatch: result: 625, took: 385 | 565 | zg CaseFolding.canonCaselessMatch: result: 626, took: 296 |
| 566 | zg CaseFold.compatCaselessMatch: result: 625, took: 593 | 566 | zg CaseFolding.compatCaselessMatch: result: 626, took: 604 |
| 567 | 567 | ||
| 568 | Ziglyph CodePointIterator: result: 3769314, took: 2 | 568 | Ziglyph CodePointIterator: result: 3691806, took: 2.5 |
| 569 | zg CodePointIterator: result: 3769314, took: 3 | 569 | zg code_point.Iterator: result: 3691806, took: 3.3 |
| 570 | 570 | ||
| 571 | Ziglyph GraphemeIterator: result: 3691806, took: 48 | 571 | Ziglyph GraphemeIterator: result: 3691806, took: 78 |
| 572 | zg GraphemeIterator: result: 3691806, took: 16 | 572 | zg Graphemes.Iterator: result: 3691806, took: 31 |
| 573 | 573 | ||
| 574 | Ziglyph Normalizer.nfkc: result: 3934162, took: 416 | 574 | Ziglyph Normalizer.nfkc: result: 3856654, took: 411 |
| 575 | zg Normalize.nfkc: result: 3934162, took: 182 | 575 | zg Normalize.nfkc: result: 3856654, took: 208 |
| 576 | 576 | ||
| 577 | Ziglyph Normalizer.nfc: result: 3955798, took: 57 | 577 | Ziglyph Normalizer.nfc: result: 3878290, took: 56 |
| 578 | zg Normalize.nfc: result: 3955798, took: 28 | 578 | zg Normalize.nfc: result: 3878290, took: 31 |
| 579 | 579 | ||
| 580 | Ziglyph Normalizer.nfkd: result: 4006398, took: 172 | 580 | Ziglyph Normalizer.nfkd: result: 3928890, took: 163 |
| 581 | zg Normalize.nfkd: result: 4006398, took: 104 | 581 | zg Normalize.nfkd: result: 3928890, took: 101 |
| 582 | 582 | ||
| 583 | Ziglyph Normalizer.nfd: result: 4028034, took: 169 | 583 | Ziglyph Normalizer.nfd: result: 3950526, took: 160 |
| 584 | zg Normalize.nfd: result: 4028034, took: 104 | 584 | zg Normalize.nfd: result: 3950526, took: 101 |
| 585 | 585 | ||
| 586 | Ziglyph Normalizer.eql: result: 625, took: 337 | 586 | Ziglyph Normalizer.eql: result: 626, took: 321 |
| 587 | Zg Normalize.eql: result: 625, took: 53 | 587 | Zg Normalize.eql: result: 626, took: 60 |
| 588 | 588 | ||
| 589 | Ziglyph display_width.strWidth: result: 3700914, took: 71 | 589 | Ziglyph display_width.strWidth: result: 3700914, took: 89 |
| 590 | zg DisplayWidth.strWidth: result: 3700914, took: 24 | 590 | zg DisplayWidth.strWidth: result: 3700914, took: 46 |
| 591 | ``` | 591 | ``` |
| 592 | 592 | ||
| 593 | These results were obtained on an M1 Mac with 16 GiB of RAM. | 593 | These results were obtained on a MacBook Pro (2021) with M1 Pro and 16 GiB of RAM. |
| 594 | 594 | ||
| 595 | In contrast to Ziglyph, zg does not have: | 595 | In contrast to Ziglyph, zg does not have: |
| 596 | 596 | ||