Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce frozen collection creation overheads for ignore-case with ASCII values #100998

Merged
merged 3 commits into from
Apr 21, 2024

Commits on Apr 13, 2024

  1. Reduce frozen collection overheads for ignore-case with ASCII values

    Two changes:
    1) We have a routine for computing ordinal ignore-case hash codes when we don't know whether the inputs are all ASCII or not. It's written to work regardless of target platform, but on .NET Core it can use string.GetHashCode(span, OrdinalIgnoreCase), which is faster than the implementation that's there, which converts the input to upper case first and then gets the hashcode of that.
    2) When analyzing keys, a HashSet is constructed of those keys to determine uniqueness of the relevant substrings being analyzed. Adding each substring to the HashSet involves getting a hash code for it. With ignore-case, we're currently using a comparer that has to work with non-ASCII, and it hits that above code path. (1) helps for .NET Core, but for .NET Framework this comparer will still end up allocating strings as part of computing the hash codes. We can do an up-front check for whether all of the values are ASCII, and if they are, we can use a better comparer that doesn't need to allocate on .NET Framework and which is also a tad faster on .NET Core.
    stephentoub committed Apr 13, 2024
    Configuration menu
    Copy the full SHA
    909a347 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2024

  1. Configuration menu
    Copy the full SHA
    9e3c4dd View commit details
    Browse the repository at this point in the history
  2. Address PR feedback

    stephentoub committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    195819c View commit details
    Browse the repository at this point in the history