summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md84
1 files changed, 42 insertions, 42 deletions
diff --git a/README.md b/README.md
index 4af2ca2..bfa8d5e 100644
--- a/README.md
+++ b/README.md
@@ -154,7 +154,7 @@ In your code:
154```zig 154```zig
155const GeneralCategories = @import("GeneralCategories"); 155const GeneralCategories = @import("GeneralCategories");
156 156
157test "General Category" { 157test "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
247const LetterCasing = @import("LetterCasing"); 247const LetterCasing = @import("LetterCasing");
248 248
249test "Case" { 249test "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
310const Normalize = @import("Normalize"); 310const Normalize = @import("Normalize");
311 311
312test "Normalization" { 312test "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```
391Case folding needs to use the `Normalize` module in order to produce the compatibility 391Case 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
537Binary sizes ======= 537Binary sizes =======
538 538
539149K ziglyph_case 539172K ziglyph_case
54087K zg_case 540109K zg_case
541 541
542275K ziglyph_caseless 542299K ziglyph_caseless
543168K zg_caseless 543175K zg_caseless
544 544
54568K ziglyph_codepoint 54591K ziglyph_codepoint
54668K zg_codepoint 54691K zg_codepoint
547 547
548101K ziglyph_grapheme 548108K ziglyph_grapheme
54986K zg_grapheme 549109K zg_grapheme
550 550
551185K ziglyph_normalizer 551208K ziglyph_normalizer
552152K zg_normalize 552175K zg_normalize
553 553
554101K ziglyph_width 554124K ziglyph_width
55586K zg_width 555109K zg_width
556 556
557Benchmarks ========== 557Benchmarks ==========
558 558
559Ziglyph toUpperStr/toLowerStr: result: 7911596, took: 80 559Ziglyph toUpperStr/toLowerStr: result: 7756580, took: 74
560Ziglyph isUpperStr/isLowerStr: result: 110959, took: 17 560Ziglyph isUpperStr/isLowerStr: result: 110959, took: 17
561zg toUpperStr/toLowerStr: result: 7911596, took: 62 561zg toUpperStr/toLowerStr: result: 7756580, took: 58
562zg isUpperStr/isLowerStr: result: 110959, took: 7 562zg isUpperStr/isLowerStr: result: 110959, took: 11
563 563
564Ziglyph Normalizer.eqlCaseless: result: 625, took: 500 564Ziglyph Normalizer.eqlCaseless: result: 626, took: 479
565zg CaseFold.canonCaselessMatch: result: 625, took: 385 565zg CaseFolding.canonCaselessMatch: result: 626, took: 296
566zg CaseFold.compatCaselessMatch: result: 625, took: 593 566zg CaseFolding.compatCaselessMatch: result: 626, took: 604
567 567
568Ziglyph CodePointIterator: result: 3769314, took: 2 568Ziglyph CodePointIterator: result: 3691806, took: 2.5
569zg CodePointIterator: result: 3769314, took: 3 569zg code_point.Iterator: result: 3691806, took: 3.3
570 570
571Ziglyph GraphemeIterator: result: 3691806, took: 48 571Ziglyph GraphemeIterator: result: 3691806, took: 78
572zg GraphemeIterator: result: 3691806, took: 16 572zg Graphemes.Iterator: result: 3691806, took: 31
573 573
574Ziglyph Normalizer.nfkc: result: 3934162, took: 416 574Ziglyph Normalizer.nfkc: result: 3856654, took: 411
575zg Normalize.nfkc: result: 3934162, took: 182 575zg Normalize.nfkc: result: 3856654, took: 208
576 576
577Ziglyph Normalizer.nfc: result: 3955798, took: 57 577Ziglyph Normalizer.nfc: result: 3878290, took: 56
578zg Normalize.nfc: result: 3955798, took: 28 578zg Normalize.nfc: result: 3878290, took: 31
579 579
580Ziglyph Normalizer.nfkd: result: 4006398, took: 172 580Ziglyph Normalizer.nfkd: result: 3928890, took: 163
581zg Normalize.nfkd: result: 4006398, took: 104 581zg Normalize.nfkd: result: 3928890, took: 101
582 582
583Ziglyph Normalizer.nfd: result: 4028034, took: 169 583Ziglyph Normalizer.nfd: result: 3950526, took: 160
584zg Normalize.nfd: result: 4028034, took: 104 584zg Normalize.nfd: result: 3950526, took: 101
585 585
586Ziglyph Normalizer.eql: result: 625, took: 337 586Ziglyph Normalizer.eql: result: 626, took: 321
587Zg Normalize.eql: result: 625, took: 53 587Zg Normalize.eql: result: 626, took: 60
588 588
589Ziglyph display_width.strWidth: result: 3700914, took: 71 589Ziglyph display_width.strWidth: result: 3700914, took: 89
590zg DisplayWidth.strWidth: result: 3700914, took: 24 590zg DisplayWidth.strWidth: result: 3700914, took: 46
591``` 591```
592 592
593These results were obtained on an M1 Mac with 16 GiB of RAM. 593These results were obtained on a MacBook Pro (2021) with M1 Pro and 16 GiB of RAM.
594 594
595In contrast to Ziglyph, zg does not have: 595In contrast to Ziglyph, zg does not have:
596 596