Skip to content

Conversation

charlottia
Copy link
Collaborator

@charlottia charlottia commented Jan 21, 2025

Fixes #509, kinda. Supersedes #510.
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.

@charlottia charlottia enabled auto-merge February 21, 2025 22:01
@charlottia charlottia merged commit 7ce7578 into main Feb 21, 2025
38 checks passed
@charlottia charlottia deleted the lotte-minimize-cm branch February 21, 2025 22:04
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