Skip to content

Conversation

@kivikakk
Copy link
Owner

This mostly just applies to smart quotes, which are unlikely to benefit hugely (small String optimisation?), but I'm interested in seeing how far we can go with Cow; what if we can avoid allocations entirely in some cases by referring to the input?

@github-actions
Copy link
Contributor

Command Mean [ms] Min [ms] Max [ms] Relative
./bench.sh ./comrak-094ddb7 128.6 ± 1.5 126.7 132.9 2.20 ± 0.11
./bench.sh ./comrak-main 128.9 ± 2.6 126.2 139.7 2.21 ± 0.11
./bench.sh ./pulldown-cmark 58.3 ± 2.7 56.8 74.8 1.00
./bench.sh ./cmark-gfm 87.4 ± 7.9 81.3 105.3 1.50 ± 0.15
./bench.sh ./markdown-it 259.5 ± 3.1 254.0 265.1 4.45 ± 0.21

Run on Sat Oct 18 10:30:46 UTC 2025

I figured there'd be a small string optimisation making this less
useful, but nope, there isn't!
@kivikakk kivikakk changed the title try Cow<'static, str> for Text nodes. Refactor, simplify, speed up. Oct 19, 2025
@kivikakk kivikakk marked this pull request as ready for review October 19, 2025 07:22
@kivikakk
Copy link
Owner Author

Rewritten an incredible amount of 2018-era C-isms and laid bare the control flow in a bunch of places! Soooo much nicer.

@kivikakk kivikakk merged commit 558bc20 into main Oct 19, 2025
44 checks passed
@kivikakk kivikakk deleted the push-wvnvvwuvxwvx branch October 19, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants