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

About query cache vs CommandFlags.NoCache running speed? #1950

Closed
znyet opened this issue Aug 20, 2023 · 1 comment
Closed

About query cache vs CommandFlags.NoCache running speed? #1950

znyet opened this issue Aug 20, 2023 · 1 comment

Comments

@znyet
Copy link

znyet commented Aug 20, 2023

How many times does the operating speed differ.
use CommandFlags.NoCache, Does it have a serious impact on the application?

@mgravell
Copy link
Member

mgravell commented Aug 21, 2023

race your horses

Here's some simple numbers

|                 ORM |                         Method | Return |      Mean |   StdDev |     Error |  Gen 0 |  Gen 1 | Gen 2 | Allocated |
|-------------------- |------------------------------- |------- |----------:|---------:|----------:|-------:|-------:|------:|----------:|
| Dapper cache impact |      ExecuteNoParameters_Cache |   Void |  93.48 us | 1.151 us |  1.740 us | 0.1250 |      - |     - |   1.42 KB |
| Dapper cache impact |    ExecuteNoParameters_NoCache |   Void |  92.81 us | 1.050 us |  1.765 us | 0.1250 |      - |     - |   1.42 KB |
|
| Dapper cache impact |        ExecuteParameters_Cache |   Void |  64.47 us | 0.721 us |  1.212 us | 0.5000 | 0.0625 |     - |   3.13 KB |
| Dapper cache impact |      ExecuteParameters_NoCache |   Void | 370.75 us | 2.988 us |  4.517 us | 2.0000 | 1.0000 |     - |  13.16 KB |
|
| Dapper cache impact |   QueryFirstNoParameters_Cache |   Void |  94.85 us | 8.402 us | 12.702 us | 0.2500 | 0.1250 |     - |   2.23 KB |
| Dapper cache impact | QueryFirstNoParameters_NoCache |   Void | 102.12 us | 0.802 us |  1.213 us | 0.2500 | 0.1250 |     - |   2.28 KB |
|
| Dapper cache impact |     QueryFirstParameters_Cache |   Void |  67.48 us | 1.064 us |  1.609 us | 0.5000 | 0.1250 |     - |   3.83 KB |
| Dapper cache impact |   QueryFirstParameters_NoCache |   Void | 388.73 us | 5.431 us |  8.210 us | 2.0000 | 1.0000 |     - |  13.87 KB |
|

Note that with AOT, there is functionally no cache - which is not to say "it sucks", but rather the opposite "the need for that concept goes away completely, and it works great/equally with known/unknown SQL "

But yes: in vanilla Dapper, this has an impact (except for the "no parameters, no row materialization" case, ExecuteNoParameters...)

mgravell added a commit that referenced this issue Aug 21, 2023
mgravell added a commit that referenced this issue Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants