Skip to content

Commit a6a166b

Browse files
authored
docs: update existing benchmark documentation to highlight performance improvements (#108)
Closes #107 Signed-off-by: purpleclay <purpleclaygh@gmail.com>
1 parent 841e0d9 commit a6a166b

File tree

1 file changed

+77
-73
lines changed

1 file changed

+77
-73
lines changed

docs/benchmarks.md

Lines changed: 77 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -10,110 +10,114 @@ go test -bench=. -benchmem ./...
1010

1111
### Basic Combinators
1212

13-
| Benchmark | ns/op | MB/s | B/op | allocs/op |
14-
| --------------- | ----: | ----: | ---: | --------: |
15-
| Tag/Ascii | 1.38 | 31168 | 0 | 0 |
16-
| Tag/Unicode | 1.42 | 42406 | 0 | 0 |
17-
| TagNoCase/Ascii | 6.71 | 6404 | 0 | 0 |
18-
| Char/Ascii | 58.50 | 735 | 180 | 2 |
19-
| Char/Unicode | 80.27 | 747 | 4 | 1 |
20-
| AnyChar/Ascii | 52.12 | 825 | 176 | 1 |
21-
| AnyChar/Unicode | 74.61 | 804 | 0 | 0 |
22-
| Take/Ascii | 72.04 | 597 | 176 | 1 |
23-
| Take/Unicode | 93.07 | 645 | 0 | 0 |
24-
| Until/Ascii | 6.40 | 6724 | 0 | 0 |
25-
| Until/Unicode | 11.67 | 5142 | 0 | 0 |
26-
| Any/Ascii | 38.42 | 1119 | 0 | 0 |
27-
| Any/Unicode | 60.88 | 986 | 0 | 0 |
28-
| Not/Ascii | 64.76 | 664 | 0 | 0 |
29-
| Not/Unicode | 114.6 | 523 | 0 | 0 |
30-
| OneOf/Ascii | 63.77 | 674 | 176 | 1 |
31-
| OneOf/Unicode | 75.27 | 797 | 0 | 0 |
32-
| NoneOf/Ascii | 53.70 | 801 | 176 | 1 |
33-
| NoneOf/Unicode | 78.33 | 766 | 0 | 0 |
13+
| Benchmark | ns/op | MB/s | B/op | allocs/op |
14+
| ----------------- | ----: | ----: | ---: | --------: |
15+
| Tag/Ascii | 1.49 | 28874 | 0 | 0 |
16+
| Tag/Unicode | 1.54 | 38849 | 0 | 0 |
17+
| TagNoCase/Ascii | 6.92 | 6217 | 0 | 0 |
18+
| Char/Ascii | 1.77 | 24247 | 0 | 0 |
19+
| Char/Unicode | 2.48 | 24239 | 0 | 0 |
20+
| AnyChar/Ascii | 1.78 | 24203 | 0 | 0 |
21+
| AnyChar/Unicode | 2.24 | 26819 | 0 | 0 |
22+
| Take/Ascii | 16.04 | 2681 | 0 | 0 |
23+
| Take/Unicode | 10.25 | 5856 | 0 | 0 |
24+
| Until/Ascii | 6.45 | 6666 | 0 | 0 |
25+
| Until/Unicode | 12.66 | 4740 | 0 | 0 |
26+
| Any/Small/Ascii | 9.32 | 4614 | 0 | 0 |
27+
| Any/Large/Ascii | 70.29 | 612 | 0 | 0 |
28+
| Any/Small/Unicode | 28.23 | 2126 | 0 | 0 |
29+
| Any/Large/Unicode | 60.30 | 995 | 0 | 0 |
30+
| Not/Small/Ascii | 52.11 | 825 | 0 | 0 |
31+
| Not/Large/Ascii | 105.6 | 407 | 0 | 0 |
32+
| Not/Small/Unicode | 93.54 | 641 | 0 | 0 |
33+
| Not/Large/Unicode | 106.9 | 562 | 0 | 0 |
34+
| OneOf/Ascii | 11.38 | 3779 | 0 | 0 |
35+
| OneOf/Unicode | 4.46 | 13452 | 0 | 0 |
36+
| NoneOf/Ascii | 3.67 | 11709 | 0 | 0 |
37+
| NoneOf/Unicode | 6.44 | 9324 | 0 | 0 |
3438

3539
### Predicate Combinators
3640

37-
| Benchmark | ns/op | MB/s | B/op | allocs/op |
38-
| ---------------------- | ----: | ---: | ---: | --------: |
39-
| While/Digit | 27.72 | 1912 | 0 | 0 |
40-
| While/Letter/Ascii | 10.16 | 4231 | 0 | 0 |
41-
| While/Letter/Unicode | 243.2 | 247 | 0 | 0 |
42-
| While/Alphanumeric | 58.19 | 275 | 0 | 0 |
43-
| While/Space | 21.10 | 2275 | 0 | 0 |
44-
| WhileNot/Digit/Ascii | 121.5 | 378 | 0 | 0 |
45-
| WhileNot/Digit/Unicode | 197.8 | 318 | 0 | 0 |
46-
| Satisfy/Ascii | 58.74 | 732 | 180 | 2 |
47-
| Satisfy/Unicode | 81.26 | 738 | 4 | 1 |
41+
| Benchmark | ns/op | MB/s | B/op | allocs/op |
42+
| ---------------------- | ----: | ----: | ---: | --------: |
43+
| While/Digit | 22.92 | 2313 | 0 | 0 |
44+
| While/Letter/Ascii | 8.69 | 4947 | 0 | 0 |
45+
| While/Letter/Unicode | 216.4 | 277 | 0 | 0 |
46+
| While/Alphanumeric | 49.99 | 320 | 0 | 0 |
47+
| While/Space | 15.74 | 3050 | 0 | 0 |
48+
| WhileNot/Digit/Ascii | 100.8 | 456 | 0 | 0 |
49+
| WhileNot/Digit/Unicode | 176.0 | 358 | 0 | 0 |
50+
| Satisfy/Ascii | 2.39 | 17980 | 0 | 0 |
51+
| Satisfy/Unicode | 2.97 | 20203 | 0 | 0 |
4852

4953
### Sequence Combinators
5054

5155
| Benchmark | ns/op | MB/s | B/op | allocs/op |
5256
| --------------------- | ----: | ---: | ---: | --------: |
53-
| Pair/Ascii | 40.04 | 1074 | 48 | 2 |
54-
| Pair/Unicode | 39.42 | 1522 | 48 | 2 |
55-
| Delimited/Parentheses | 8.44 | 2487 | 0 | 0 |
56-
| Delimited/Quotes | 8.63 | 2432 | 0 | 0 |
57-
| SepPair | 64.19 | 218 | 48 | 2 |
58-
| All/ThreeTags | 64.86 | 663 | 112 | 3 |
59-
| All/FiveTags | 102.2 | 421 | 240 | 4 |
57+
| Pair/Ascii | 41.16 | 1045 | 48 | 2 |
58+
| Pair/Unicode | 40.89 | 1468 | 48 | 2 |
59+
| Delimited/Parentheses | 8.24 | 2550 | 0 | 0 |
60+
| Delimited/Quotes | 8.48 | 2476 | 0 | 0 |
61+
| SepPair | 60.00 | 233 | 48 | 2 |
62+
| All/ThreeTags | 68.62 | 627 | 112 | 3 |
63+
| All/FiveTags | 105.0 | 409 | 240 | 4 |
6064

6165
### Modifier Combinators
6266

6367
| Benchmark | ns/op | MB/s | B/op | allocs/op |
6468
| ------------ | ----: | ----: | ----: | --------: |
65-
| Opt/Match | 1.81 | 23783 | 0 | 0 |
66-
| Opt/NoMatch | 1.81 | 25486 | 0 | 0 |
67-
| Map | 16.47 | 2914 | 0 | 0 |
68-
| Many/Small | 127.7 | 110 | 288 | 5 |
69-
| Many/Medium | 605.1 | 172 | 2208 | 8 |
70-
| Many/Large | 4324 | 232 | 18848 | 11 |
71-
| Peek/Ascii | 63.05 | 682 | 176 | 1 |
72-
| Peek/Unicode | 93.80 | 640 | 0 | 0 |
73-
| Flatten | 87.92 | 489 | 128 | 4 |
69+
| Opt/Match | 2.15 | 20017 | 0 | 0 |
70+
| Opt/NoMatch | 2.20 | 20937 | 0 | 0 |
71+
| Map | 14.52 | 3307 | 0 | 0 |
72+
| Many/Small | 130.4 | 107 | 288 | 5 |
73+
| Many/Medium | 615.4 | 169 | 2208 | 8 |
74+
| Many/Large | 4270 | 235 | 18848 | 11 |
75+
| Peek/Ascii | 7.29 | 5895 | 0 | 0 |
76+
| Peek/Unicode | 11.05 | 5429 | 0 | 0 |
77+
| Flatten | 91.81 | 468 | 128 | 4 |
7478

7579
### Control Flow Combinators
7680

7781
| Benchmark | ns/op | MB/s | B/op | allocs/op |
7882
| ----------------- | ----: | -----: | ---: | --------: |
79-
| First/FirstMatch | 3.96 | 10868 | 0 | 0 |
80-
| First/LastMatch | 118.2 | 118 | 128 | 4 |
81-
| Verify/Pass | 16.66 | 2881 | 0 | 0 |
82-
| Recognize/Ascii | 163.4 | 263 | 400 | 6 |
83-
| Recognize/Unicode | 213.5 | 281 | 80 | 4 |
84-
| Consumed | 77.71 | 553 | 112 | 4 |
83+
| First/FirstMatch | 3.97 | 10833 | 0 | 0 |
84+
| First/LastMatch | 124.9 | 112 | 128 | 4 |
85+
| Verify/Pass | 14.37 | 3341 | 0 | 0 |
86+
| Recognize/Ascii | 45.99 | 935 | 48 | 2 |
87+
| Recognize/Unicode | 49.37 | 1215 | 48 | 2 |
88+
| Consumed | 81.93 | 525 | 112 | 4 |
8589
| Eof | 0.23 | - | 0 | 0 |
86-
| AllConsuming | 3.71 | 5125 | 0 | 0 |
87-
| Rest/Ascii | 0.23 | 190713 | 0 | 0 |
88-
| Rest/Unicode | 0.23 | 265547 | 0 | 0 |
89-
| Value | 3.71 | 12677 | 0 | 0 |
90-
| Cond/True | 3.48 | 12340 | 0 | 0 |
91-
| Cond/False | 1.24 | 34555 | 0 | 0 |
92-
| Cut | 3.67 | 11720 | 0 | 0 |
90+
| AllConsuming | 3.73 | 5100 | 0 | 0 |
91+
| Rest/Ascii | 0.23 | 190050 | 0 | 0 |
92+
| Rest/Unicode | 0.23 | 265677 | 0 | 0 |
93+
| Value | 3.51 | 13393 | 0 | 0 |
94+
| Cond/True | 3.48 | 12358 | 0 | 0 |
95+
| Cond/False | 1.34 | 32030 | 0 | 0 |
96+
| Cut | 3.72 | 11564 | 0 | 0 |
9397

9498
### Parser Combinators
9599

96100
| Benchmark | ns/op | MB/s | B/op | allocs/op |
97101
| ----------- | ----: | ----: | ---: | --------: |
98-
| Crlf | 3.44 | 13096 | 0 | 0 |
99-
| Eol/Ascii | 157.9 | 279 | 80 | 3 |
100-
| Eol/Unicode | 143.0 | 427 | 80 | 3 |
102+
| Crlf | 3.24 | 13871 | 0 | 0 |
103+
| Eol/Ascii | 58.23 | 756 | 0 | 0 |
104+
| Eol/Unicode | 56.85 | 1073 | 0 | 0 |
101105

102106
### Scaling Benchmarks
103107

104108
| Benchmark | ns/op | MB/s | B/op | allocs/op |
105109
| ------------------- | ----: | ----: | ---: | --------: |
106-
| UntilScaling/Small | 5.46 | 1648 | 0 | 0 |
107-
| UntilScaling/Medium | 6.75 | 15400 | 0 | 0 |
108-
| UntilScaling/Large | 109.3 | 91541 | 0 | 0 |
109-
| WhileScaling/Small | 11.15 | 538 | 0 | 0 |
110-
| WhileScaling/Medium | 278.3 | 370 | 0 | 0 |
111-
| WhileScaling/Large | 29807 | 336 | 0 | 0 |
110+
| UntilScaling/Small | 5.66 | 1589 | 0 | 0 |
111+
| UntilScaling/Medium | 6.98 | 14909 | 0 | 0 |
112+
| UntilScaling/Large | 115.9 | 86300 | 0 | 0 |
113+
| WhileScaling/Small | 8.70 | 690 | 0 | 0 |
114+
| WhileScaling/Medium | 205.6 | 501 | 0 | 0 |
115+
| WhileScaling/Large | 19816 | 505 | 0 | 0 |
112116

113117
### Real-World Patterns
114118

115119
| Benchmark | ns/op | MB/s | B/op | allocs/op |
116120
| ------------- | ----: | ---: | ---: | --------: |
117-
| KeyValuePair | 48.10 | 665 | 48 | 2 |
118-
| GitDiffHeader | 102.1 | 186 | 160 | 5 |
119-
| CSVField | 32.89 | 912 | 0 | 0 |
121+
| KeyValuePair | 51.34 | 623 | 48 | 2 |
122+
| GitDiffHeader | 102.4 | 185 | 160 | 5 |
123+
| CSVField | 26.64 | 1126 | 0 | 0 |

0 commit comments

Comments
 (0)