[PR #305] Emoji and abbreviations parser #938

Closed
opened 2026-01-29 14:47:32 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/xoofx/markdig/pull/305

State: closed
Merged: Yes


Fixes #296
Fewer memory allocations:

Building a new pipeline:

Method Mean Gen 0/1k Op Gen 1/1k Op Allocated Memory/Op
Markdig 12.05 us 19.1498 - 14.72 KB
Markdig_Advanced 42.11 us 45.1660 - 34.75 KB
Markdig_Advanced_Emoji 1,490.56 us 285.1563 130.8594 1502.8 KB
Markdig_Advanced_Emoji_Modified 1,499.65 us 298.8281 126.9531 1502.77 KB
(new) Method Mean Gen 0/1k Op Gen 1/1k Op Allocated Memory/Op
Markdig 12.04 us 19.1498 - 14.72 KB
Markdig_Advanced 41.97 us 45.1660 - 34.75 KB
Markdig_Advanced_Emoji 194.58 us 76.6602 15.3809 134.75 KB
Markdig_Advanced_Emoji_Modified 252.09 us 85.4492 18.5547 162.05 KB

Where Modified forces the lazy-init of dictionary properties.

Parsing speed for emojis and abbreviations is about the same (~10% faster for emojis),
as the dataset could be considered the worst-case for a prefix tree of this type (every input starts with the same character).

**Original Pull Request:** https://github.com/xoofx/markdig/pull/305 **State:** closed **Merged:** Yes --- Fixes #296 Fewer memory allocations: Building a new pipeline: | Method | Mean | Gen 0/1k Op | Gen 1/1k Op | Allocated Memory/Op | |-------------------------------- |------------:|------------:|------------:|--------------------:| | Markdig | 12.05 us | 19.1498 | - | 14.72 KB | | Markdig_Advanced | 42.11 us | 45.1660 | - | 34.75 KB | | Markdig_Advanced_Emoji | 1,490.56 us | 285.1563 | 130.8594 | 1502.8 KB | | Markdig_Advanced_Emoji_Modified | 1,499.65 us | 298.8281 | 126.9531 | 1502.77 KB | | (new) Method | Mean | Gen 0/1k Op | Gen 1/1k Op | Allocated Memory/Op | |-------------------------------- |------------:|------------:|------------:|--------------------:| | Markdig | 12.04 us | 19.1498 | - | 14.72 KB | | Markdig_Advanced | 41.97 us | 45.1660 | - | 34.75 KB | | Markdig_Advanced_Emoji | 194.58 us | 76.6602 | 15.3809 | 134.75 KB | | Markdig_Advanced_Emoji_Modified | 252.09 us | 85.4492 | 18.5547 | 162.05 KB | Where `Modified` forces the lazy-init of dictionary properties. Parsing speed for emojis and abbreviations is about the same (~10% faster for emojis), as the dataset could be considered the worst-case for a prefix tree of this type (every input starts with the same character).
claunia added the pull-request label 2026-01-29 14:47:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#938