Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commonmark: experimental minimize #523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

charlottia
Copy link
Collaborator

@charlottia charlottia commented Jan 21, 2025

Fixes #509, kinda.
Experimental-quality CommonMark output minimizer.

Doesn't encode any intelligence about the underlying format; tries removing every backslash (\\) escape in order and sees if the document parses the same, accumulating those deletions that do.

It's wasteful but better than nothing!

Copy link
Contributor

Command Mean [ms] Min [ms] Max [ms] Relative
./bench.sh ./comrak-cc84aa7 316.3 ± 1.0 314.5 319.1 2.91 ± 0.03
./bench.sh ./comrak-main 318.6 ± 2.7 314.7 329.3 2.93 ± 0.03
./bench.sh ./pulldown-cmark 108.8 ± 0.9 107.4 111.2 1.00
./bench.sh ./cmark-gfm 115.7 ± 1.4 113.3 119.2 1.06 ± 0.02
./bench.sh ./markdown-it 486.8 ± 10.6 475.2 523.3 4.47 ± 0.10

Run on Tue Jan 21 09:39:02 UTC 2025

@kivikakk
Copy link
Owner

Tried here, works well: kivikakk/kivikakk@2f99e2f.

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.

Number/hash sign (#) is escaped
2 participants