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

Align Task usage / ArrayPool / IsColumnEncryptionSupported netcore/netfx #2982

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

MichelZ
Copy link
Contributor

@MichelZ MichelZ commented Nov 6, 2024

Part of #2953

Aligning Task return, bringing over ArrayPool usage and aligning IsColumnEncryptionSupported changes between netcore and netfx

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 75.67568% with 18 lines in your changes missing coverage. Please review.

Project coverage is 72.46%. Comparing base (4bc9ee6) to head (43a4fd6).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...nt/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs 78.26% 15 Missing ⚠️
.../netcore/src/Microsoft/Data/SqlClient/TdsParser.cs 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2982      +/-   ##
==========================================
- Coverage   72.50%   72.46%   -0.04%     
==========================================
  Files         288      288              
  Lines       59529    59507      -22     
==========================================
- Hits        43159    43122      -37     
- Misses      16370    16385      +15     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore 75.39% <40.00%> (-0.05%) ⬇️
netfx 70.90% <78.26%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this is a decent change. I'm hesitant to start touching things in the TdsParser, but these changes seem to be pretty constrained. Only a few comments. Not sure about the feasibility of using stackalloc instead of array pool in the last commit.

@@ -12807,119 +12807,127 @@ private async Task WriteXmlFeed(XmlDataFeed feed, TdsParserStateObject stateObj,
private async Task WriteTextFeed(TextDataFeed feed, Encoding encoding, bool needBom, TdsParserStateObject stateObj, int size, bool useReadBlock)
{
Debug.Assert(encoding == null || !needBom);
char[] inBuff = new char[constTextBufferSize];
char[] inBuff = ArrayPool<char>.Shared.Rent(constTextBufferSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For something like this, can we just do a stackalloc?

Copy link
Contributor Author

@MichelZ MichelZ Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's unsafe territory... I don't think I'm the right person for that :)
(This just mirrors the implementation from netcore to netfx)

byte[] buff = new byte[constBinBufferSize];
int nWritten = 0;
do
byte[] buff = ArrayPool<byte>.Shared.Rent(constBinBufferSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, can we use a stackalloc?

Copy link
Contributor Author

@MichelZ MichelZ Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's unsafe territory... I don't think I'm the right person for that :)
(This just mirrors the implementation from netcore to netfx)

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

Successfully merging this pull request may close these issues.

2 participants