[PR #866] [MERGED] Improve Alert parsing perf #1260

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/866
Author: @MihaZupan
Created: 4/14/2025
Status: Merged
Merged: 4/15/2025
Merged by: @xoofx

Base: masterHead: alert-perf


📝 Commits (2)

  • 0d6343b Make AlertBlock parsing a bit cheaper
  • bbefce3 Sealed + ref struct

📊 Changes

5 files changed (+27 additions, -20 deletions)

View changed files

📝 src/Markdig/Extensions/Alerts/AlertBlock.cs (+1 -1)
📝 src/Markdig/Extensions/Alerts/AlertInlineParser.cs (+23 -16)
📝 src/Markdig/MarkdownPipeline.cs (+1 -1)
📝 src/Markdig/Syntax/MarkdownObject.cs (+1 -1)
📝 src/Markdig/Syntax/QuoteBlock.cs (+1 -1)

📄 Description

  • Do the fast-path check for ! first since that's likely to fail to lower the overhead on text with lots of regular links.
  • Avoid the string allocations for $"markdown-alert-{alertType.ToString().ToLowerInvariant()}"
    • alertType substring + lowercase + concat result

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/xoofx/markdig/pull/866 **Author:** [@MihaZupan](https://github.com/MihaZupan) **Created:** 4/14/2025 **Status:** ✅ Merged **Merged:** 4/15/2025 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `alert-perf` --- ### 📝 Commits (2) - [`0d6343b`](https://github.com/xoofx/markdig/commit/0d6343b421734d15d71fc4b48c7e780fc085d3d7) Make AlertBlock parsing a bit cheaper - [`bbefce3`](https://github.com/xoofx/markdig/commit/bbefce3b1f2d38346fa6d6888137330de129f9a3) Sealed + ref struct ### 📊 Changes **5 files changed** (+27 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig/Extensions/Alerts/AlertBlock.cs` (+1 -1) 📝 `src/Markdig/Extensions/Alerts/AlertInlineParser.cs` (+23 -16) 📝 `src/Markdig/MarkdownPipeline.cs` (+1 -1) 📝 `src/Markdig/Syntax/MarkdownObject.cs` (+1 -1) 📝 `src/Markdig/Syntax/QuoteBlock.cs` (+1 -1) </details> ### 📄 Description - Do the fast-path check for `!` first since that's likely to fail to lower the overhead on text with lots of regular links. - Avoid the string allocations for `$"markdown-alert-{alertType.ToString().ToLowerInvariant()}"` - alertType substring + lowercase + concat result --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 14:52:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1260