[PR #917] Use Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups. #1309

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/917
Author: @prozolic
Created: 11/28/2025
Status: 🔄 Open

Base: masterHead: TryAdd


📝 Commits (2)

  • 7163471 Use Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups.
  • 6c11991 Update src/Markdig/Parsers/ParserList.cs

📊 Changes

4 files changed (+27 additions, -11 deletions)

View changed files

📝 src/Markdig/Helpers/CharacterMap.cs (+1 -4)
📝 src/Markdig/Parsers/ParserList.cs (+2 -3)
src/Markdig/Polyfills/DictionaryExtensions.cs (+23 -0)
📝 src/Markdig/Syntax/LinkReferenceDefinitionGroup.cs (+1 -4)

📄 Description

This PR replace Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups.


🔄 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/917 **Author:** [@prozolic](https://github.com/prozolic) **Created:** 11/28/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `TryAdd` --- ### 📝 Commits (2) - [`7163471`](https://github.com/xoofx/markdig/commit/7163471913ac0d6ebe3d86a230fed21d50e64085) Use Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups. - [`6c11991`](https://github.com/xoofx/markdig/commit/6c11991642585ee7ce90d967a9c65e396bbabc44) Update src/Markdig/Parsers/ParserList.cs ### 📊 Changes **4 files changed** (+27 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig/Helpers/CharacterMap.cs` (+1 -4) 📝 `src/Markdig/Parsers/ParserList.cs` (+2 -3) ➕ `src/Markdig/Polyfills/DictionaryExtensions.cs` (+23 -0) 📝 `src/Markdig/Syntax/LinkReferenceDefinitionGroup.cs` (+1 -4) </details> ### 📄 Description This PR replace Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups. --- <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:56 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1309