Perf | various performance improvements for SqlDataReader, TdsParser, SqlGuid and SqlBinary #2308
Perf | various performance improvements for SqlDataReader, TdsParser, SqlGuid and SqlBinary #2308wilbit wants to merge 8 commits into
Conversation
This reverts commit 288a70c partially
similar how it's don for netfx
) follow up changes for PR dotnet#1934
…data in SqlDataReader and TdsParser (dotnet#2308)
…aReader and ValueUtilsSmi (dotnet#2308)
|
For changes like avoiding the SqlBinary getter consider exceptions. For example, if that code path end up with the wrong data in the buffer, a string or something else, and you request the SqlBinary value currently it's going to throw an InvalidCastException, will your changed code path do the same? Because it's a very old library any externally visible behaviour change is going to break some code somewhere. |
| #if NET7_0_OR_GREATER | ||
| value.SqlBinary = SqlBinary.WrapBytes(unencryptedBytes); | ||
| #else | ||
| value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(unencryptedBytes, true); // doesn't copy the byte array | ||
| #endif |
There was a problem hiding this comment.
This may not be safe because unencryptedBytes is a parameter so you will need to audit all the callsites to make sure that ownership is always relinquished by the callers.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2308 +/- ##
===========================================
- Coverage 72.49% 56.87% -15.63%
===========================================
Files 310 304 -6
Lines 61868 61557 -311
===========================================
- Hits 44854 35009 -9845
- Misses 17014 26548 +9534
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Thanks for the feedback, @Wraith2 , I will consider that. |
|
Closed PR since it's been inactive for more than a month and is not ready to be reviewed. |
I was working on boxing of
SqlBinaryparticularly, but found more kinda related issues.The PR fixes:
SqlBinarystruct;SqlBinary's internal array of bytes back and forth;SqlGuid.