[PR #394] [MERGED] Use HashSet<T> instead of Dictionary<TKey, TValue> in CharacterMap<T> #988

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/394
Author: @KrisVandermotten
Created: 1/31/2020
Status: Merged
Merged: 1/31/2020
Merged by: @xoofx

Base: masterHead: charactermap


📝 Commits (1)

  • d4f43f8 Use HashSet instead of Dictionary<TKey, TValue> in CharacterMap

📊 Changes

1 file changed (+3 additions, -7 deletions)

View changed files

📝 src/Markdig/Helpers/CharacterMap.cs (+3 -7)

📄 Description

The CharacterMap<T> constructor counts the occurrence of each opening character, but doesn't use the actual count.

This PR replaces the Dictionary<char, int> by a HashSet<char>. The dictionary used to be indexed three or four times per iteration though the loop, the hashSet is indexed once per iteration.


🔄 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/394 **Author:** [@KrisVandermotten](https://github.com/KrisVandermotten) **Created:** 1/31/2020 **Status:** ✅ Merged **Merged:** 1/31/2020 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `charactermap` --- ### 📝 Commits (1) - [`d4f43f8`](https://github.com/xoofx/markdig/commit/d4f43f826fe8d592adbb290cc7baada812644a94) Use HashSet<T> instead of Dictionary<TKey, TValue> in CharacterMap<T> ### 📊 Changes **1 file changed** (+3 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig/Helpers/CharacterMap.cs` (+3 -7) </details> ### 📄 Description The `CharacterMap<T>` constructor counts the occurrence of each opening character, but doesn't use the actual count. This PR replaces the `Dictionary<char, int>` by a `HashSet<char>`. The dictionary used to be indexed three or four times per iteration though the loop, the hashSet is indexed once per iteration. --- <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:48:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#988