-
Notifications
You must be signed in to change notification settings - Fork 280
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
Question: Get rid of NameValuePair _keyChain field in DbConnectionOptions.Common.cs #682
Comments
@TrayanZapryanov Thanks for bringing this up to our attention. We will look into this issue and get back to you soon. |
@Wraith2 Can we move our discussion about caching parsed values here as other 681 is just an issue and can be solved with simple if around ETW log? Some time ago I saw an lock free LRU in runtime repo: Regex.Cache Maybe it is the correct structure to be used storing _parsetable/_keyChain per connection string. |
Give it a try and see how it affects perf. If it's in runtime it's probably ok to pull in a copy here as long as there are no functional changes that require a re-audit of functionality. |
I will try to submit a PR tomorrow. |
Unfortunatelly I was wrong that allocations came from parsing connection string to key/value pairs. This parsing is done once per connnection string and then cached in DbConnectionFactory by _connectionPoolGroups dictionary. Once other issues that I've raised (681 and 680) are in, I receive following benchmark results: BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19041.388 (2004/?/20H1)
Still there is some regression, but way better that before. Also a bit better in allocations. |
If your proposed changes reduce duplicities or enhance readability, they're good changes. |
In DbConnectionOptions there are two quite similar structures to store connection string Key/Value pairs.
The main difference that I can see is only the order.
Is it really critical to show values as passed from user(password replaced with *), or it doesn't matter ?
File: DbConnectionOptions.Common.cs
Fields:
`
private readonly Dictionary<string, string> _parsetable;
internal readonly NameValuePair _keyChain;
`
If I comment _keyChain - it looks to be used only in ExpandAttachDbFileName and ReplacePasswordPwd.
Both can be mimic with _parsetable.
The text was updated successfully, but these errors were encountered: