Conversation
…xtConversions Two small improvements to TextConversions.RemoveAdorners: 1. Switch DefaultRemovableAdornerCharacters from F# Set<char> (O(log n) lookup) to System.Collections.Generic.HashSet<char> (O(1) lookup). The set has ~26 characters; while individual operations are fast, this function is called on every cell when parsing CSV/JSON/XML for AsInteger, AsDecimal, AsInteger64. 2. Replace the manual mutable-flag loop with String.exists, which short-circuits on the first adorner match. The previous loop always iterated to the end even after finding an adorner. For values like ',234' the adorner is at index 0, so early exit skips 5 unnecessary iterations. No API change — DefaultRemovableAdornerCharacters is private. The public DefaultNonCurrencyAdorners and DefaultCurrencyAdorners members remain Set<char>. All 2896 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
approved these changes
Apr 3, 2026
This was referenced Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
What and Why
Two small improvements to
TextConversions.RemoveAdorners, which is called on every cell value during CSV/JSON/XML parsing forAsInteger,AsDecimal, andAsInteger64.1.
HashSet<char>instead of F#Set<char>for the private adorner setThe set has ~26 characters. F#
Set.Containsis O(log n) (balanced BST).HashSet<char>.Containsis O(1). The public membersDefaultNonCurrencyAdornersandDefaultCurrencyAdornersremainSet<char>— no API change.2.
String.existswith early exit instead of a manual loopThe previous loop always iterated to the end of the string even after finding an adorner.
String.existsshort-circuits on the first match. For values like"$1,234", the adorner$is at index 0, so the remaining 5 characters are unnecessary work.Test Status
dotnet test tests/FSharp.Data.Core.Tests/— 2896 passed, 0 failed