-
Notifications
You must be signed in to change notification settings - Fork 284
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
Perf | various performance improvements for SqlDataReader, TdsParser, SqlGuid and SqlBinary #2308
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
SqlBinary
particularly, but found more kinda related issues.The PR fixes:
SqlBinary
struct;SqlBinary
's internal array of bytes back and forth;SqlGuid
.