-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
DictionarySource Performance #186
Comments
Hi |
#### Target frameworks * Changed `netstandard2.0` to `netstandard2.1`. * `net461` support unchanged. * Added package `System.Memory` #### Remove repetitive substring allocations Connected modifications: * Added method `Write(ReadOnlySpan<char> text)` to `IFormattingInfo` * Generated substrings are cached in classes `Format`, `FormatItem`, `LiteralText`, `Placeholder` and `Selector`. * Evaluating escaped characters for `Placeholder.FormatterOptions` and `LiteralText` work without heap memory allocation. #### Alignment operator inheritance is optimized * Alignment implementation introduced with PR [#174](#174) is modified for better performance * Added method `Placeholder.AddSelector` * `Placeholder.Selectors` is now internal. Selectors are accessible with `IReadOnlyList<Selector> Placeholder.GetSelectors()`. #### DictionarySource performance improved * Implemented suggestion in issue [#186](#186) for better speed and less GC pressure. * Side effect: We're using the `CaseSensitivityType` of the dictionary for getting the value for a key. `Settings.GetCaseSensitivityComparison()` will not be applied.
Resolved with PR #189, part of v3.0.0-alpha.1 |
#### Target frameworks * Changed `netstandard2.0` to `netstandard2.1`. * `net461` support unchanged. * Added package `System.Memory` #### Remove repetitive substring allocations Connected modifications: * Added method `Write(ReadOnlySpan<char> text)` to `IFormattingInfo` * Generated substrings are cached in classes `Format`, `FormatItem`, `LiteralText`, `Placeholder` and `Selector`. * Evaluating escaped characters for `Placeholder.FormatterOptions` and `LiteralText` work without heap memory allocation. #### Alignment operator inheritance is optimized * Alignment implementation introduced with PR [axuno#174](axuno#174) is modified for better performance * Added method `Placeholder.AddSelector` * `Placeholder.Selectors` is now internal. Selectors are accessible with `IReadOnlyList<Selector> Placeholder.GetSelectors()`. #### DictionarySource performance improved * Implemented suggestion in issue [axuno#186](axuno#186) for better speed and less GC pressure. * Side effect: We're using the `CaseSensitivityType` of the dictionary for getting the value for a key. `Settings.GetCaseSensitivityComparison()` will not be applied.
Hey.
I noticed that the DictionarySource is iterating through all the keys to find a match, this is probably because of the case sensitivity option. I wonder if it would be possible to use the TryGetValue method when the Dictionary is using the same EqualityComparer?
Something like this?
The text was updated successfully, but these errors were encountered: