- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inlines: make this.matches a dense rather than sparse array.
This yields a significant performance boost. See #13. Of course, the speedup depends on the input. This will mostly affect texts with significant strings of inlines (longer paragraphs rather than just a few words). But on those, we are more than twice as fast with this change. Here are some inline-heavy benchmarks for comparison: This branch: parse inline-em-flat.dj x 24,362 ops/sec ±0.26% (95 runs sampled) parse lorem1.dj x 13,244 ops/sec ±0.29% (101 runs sampled) parse inline-em-nested.dj x 25,121 ops/sec ±0.23% (96 runs sampled) parse inline-em-worst.dj x 27,437 ops/sec ±0.66% (92 runs sampled) parse readme.dj x 2,529 ops/sec ±0.55% (96 runs sampled) Current main: parse inline-em-flat.dj x 25,057 ops/sec ±0.26% (99 runs sampled) parse lorem1.dj x 5,846 ops/sec ±0.26% (98 runs sampled) parse inline-em-nested.dj x 25,584 ops/sec ±0.26% (100 runs sampled) parse inline-em-worst.dj x 26,859 ops/sec ±0.29% (98 runs sampled) parse readme.dj x 1,144 ops/sec ±0.43% (96 runs sampled) Thanks to @matklad for identifying this as a bottleneck and suggesting the general direction of the improvement.
Showing
1 changed file
with
79 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters