ya-bbcode 5.1.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,6 +36,39 @@ parser.clearTags();
36
36
  - **Zero dependencies**: Lightweight with no external dependencies
37
37
  - **Correct parsing**: Parent nodes are parsed before children in nested format
38
38
  - **Customizable**: Easy to add or override tags
39
+ - **Fast**: Single-pass parser, benchmarked against other BBCode libraries on every pull request
40
+
41
+ ### Benchmarks
42
+ `npm run build && npm run bench` compares ya-bbcode with other BBCode parsers on a set of documents, checks that ya-bbcode's output for each one is exactly the expected HTML, and measures how parse time grows with input size. The run fails if any output is wrong or if parsing stops scaling linearly.
43
+
44
+ Options go after `--`, for example `npm run bench -- --filter list --time 200`:
45
+
46
+ | Option | Effect |
47
+ | --- | --- |
48
+ | `--baseline <path>` | Also measure another build of ya-bbcode (such as a copy of `dist/ya-bbcode.mjs` from `main`) and report the speed-up against it |
49
+ | `--filter <text>` | Only run the cases whose name contains the text |
50
+ | `--time <ms>` | Time spent measuring each row (default 500) |
51
+ | `--json <path>` | Write every measurement to a file |
52
+ | `--skip-scaling` | Skip the input-size scaling section |
53
+
54
+ Results in operations per second (higher is better) on Node 26. `@bbob/parser` only builds a syntax tree; the others render HTML.
55
+
56
+ | Case | ya-bbcode | @bbob/html | @bbob/parser | xbbcode-parser |
57
+ | --- | --- | --- | --- | --- |
58
+ | Short (Simple Bold) | 1,337,472 | 233,413 | 410,176 | 95,803 |
59
+ | Medium (Nested Quote) | 580,203 | 74,614 | 125,420 | 39,603 |
60
+ | Long (Forum Post) | 154,402 | 13,388 | 19,912 | 11,854 |
61
+ | Complex (Deep Nesting) | 143,763 | 19,311 | 29,268 | 7,148 |
62
+ | Deep Nesting (5 levels) | 419,269 | 74,212 | 113,577 | 34,437 |
63
+ | URL Heavy (10 links) | 144,913 | 19,638 | 26,843 | 16,260 |
64
+ | List Heavy (50 items) | 26,555 | 1,650 | 3,338 | 867 |
65
+ | Image Gallery (12 linked images) | 52,083 | 8,855 | 13,470 | 5,983 |
66
+ | Plain Text (no tags) | 874,507 | 17,104 | 22,061 | 134,275 |
67
+ | HTML Heavy (escaping) | 67,709 | 9,907 | 11,465 | 40,151 |
68
+ | Noparse Block (90 literal tags) | 108,082 | 3,746 | 5,279 | 11,798 |
69
+ | Malformed (tag soup) | 132,255 | 21,548 | 29,741 | 28,053 |
70
+ | Guide (8 mixed sections) | 19,347 | 2,010 | 3,127 | 1,266 |
71
+ | Large Document (BBob stub) | 5,260 | 779 | 1,015 | 321 |
39
72
 
40
73
  ### Changelog
41
74
  Release notes are published on [GitHub Releases](https://github.com/nodecraft/ya-bbcode/releases). Notes for 5.0.0 and earlier are in [CHANGELOG.md](CHANGELOG.md).