-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query: Auto-buffer data readers in SqlServer when split query & MARS off #21456
Conversation
This file contains 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
src/EFCore.SqlServer/Query/Internal/SqlServerCompiledQueryCacheKeyGenerator.cs
Outdated
Show resolved
Hide resolved
AndriySvyryd
approved these changes
Jun 29, 2020
roji
reviewed
Jun 29, 2020
roji
reviewed
Jun 29, 2020
smitpatel
force-pushed
the
smit/displosalfacility
branch
from
June 29, 2020 18:51
f3e26c9
to
44f84fc
Compare
smitpatel
force-pushed
the
smit/MARS
branch
2 times, most recently
from
June 29, 2020 19:31
e7ff9dc
to
51b8eec
Compare
roji
approved these changes
Jun 29, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark results:
BenchmarkDotNet=v0.12.0, OS=ubuntu 20.04
Intel Xeon W-2133 CPU 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=5.0.100-preview.6.20318.15
[Host] : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), X64 RyuJIT
DefaultJob : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), X64 RyuJIT
Method | Mean | Error | StdDev |
---|---|---|---|
WithoutConcurrentDictionary | 6,411.03 ns | 33.443 ns | 31.283 ns |
WithConcurrentDictionary | 96.99 ns | 0.212 ns | 0.177 ns |
i.e. avoid parsing connection strings if at all possible :)
Benchmark code
public class Program
{
private static readonly ConcurrentDictionary<string, bool> _cache
= new ConcurrentDictionary<string, bool>();
private const string ConnectionString =
"Server=localhost;Database=test;User=SA;Password=Abcd5678;ConnectRetryCount=0;MultipleActiveResultSets=true";
[Benchmark]
public bool WithoutConcurrentDictionary()
=> new SqlConnectionStringBuilder(ConnectionString).MultipleActiveResultSets;
[Benchmark]
public bool WithConcurrentDictionary()
=> _cache.GetOrAdd(ConnectionString,
cs => new SqlConnectionStringBuilder(ConnectionString).MultipleActiveResultSets);
static void Main(string[] args)
=> BenchmarkRunner.Run<Program>();
}
Hello @smitpatel! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This pull request was closed.
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.
Resolves #21420