Skip to content

Avoid captures in SqlConnection.ReadBlob#36127

Merged
sharwell merged 1 commit intodotnet:masterfrom
sharwell:readblob-no-capture
Jun 4, 2019
Merged

Avoid captures in SqlConnection.ReadBlob#36127
sharwell merged 1 commit intodotnet:masterfrom
sharwell:readblob-no-capture

Conversation

@sharwell
Copy link
Copy Markdown
Contributor

@sharwell sharwell commented Jun 3, 2019

This change produced a 806MB (11.3%) allocation reduction in the scenario described by #36114.

This change produced a 806MB (11.3%) allocation reduction in the scenario
described by dotnet#36114.
@sharwell sharwell requested a review from a team as a code owner June 3, 2019 14:38
@Therzok
Copy link
Copy Markdown
Contributor

Therzok commented Jun 3, 2019

Aren't these changes mostly in #34790?

@sharwell
Copy link
Copy Markdown
Contributor Author

sharwell commented Jun 3, 2019

@Therzok Yes, but I resubmitted them with finer granularity and data against the standardized test. There are also some minor style changes so it matches Roslyn, and a couple of changes that did not make a significant difference were excluded to ensure the reviews are focused on the items of interest.

@sharwell
Copy link
Copy Markdown
Contributor Author

sharwell commented Jun 3, 2019

@Therzok It wasn't my intent to duplicate your change. More a side effect of trying to document the baseline values and validate the incremental improvements matched the claims. In the end, it certainly appears that the new test is an accurate representation of the scenario you wanted to improve, since we arrived at very similar conclusions. In hindsight, I'd actually be a bit concerned if these PRs didn't have significant overlap with yours.

@Therzok
Copy link
Copy Markdown
Contributor

Therzok commented Jun 3, 2019

Oh, no worries, I was just thinking the commits would be cherry-pickable, but after looking at my PR again, they touch multiple things in the 'address PR feedback' commits. So looks good to me!

public void RunInTransaction<TState>(Action<TState> action, TState state)
{
RunInTransaction(
state =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fwiw, calling this state was super confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😕 I thought that was the normal name for this. Examples of alternatives?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's more that the outer param for RunInTransaction is called "state" and hte inner one is called "state" and my brain exploded with confusion. Honestly, i'd be 100% fine with you calling the inner one tuple :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's also a nit. if you're ok with this, it's NBD. just giving you my stream of consciousness thoughts as i tried to grok things :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've seen other instances of this pattern with TArg and arg.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: the pattern is fine. it's literally the fact that there are two params called 'state', and then the code has state.state :D It's purely naming i don't like. arg or tuple would be great IMO just for some simple clarity.

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

Approve
Submit feedback approving these changes.

@jinujoseph jinujoseph added this to the 16.2.P3 milestone Jun 4, 2019
@sharwell sharwell merged commit 8401888 into dotnet:master Jun 4, 2019
@sharwell sharwell deleted the readblob-no-capture branch June 4, 2019 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants