Suppress ExecutionContext flow on SQLite hot path#53503
Merged
sharwell merged 1 commit intodotnet:mainfrom Jun 2, 2021
Merged
Conversation
AArnott
approved these changes
May 19, 2021
| // ⚠ DO NOT AWAIT INSIDE THE USING. The Dispose method that restores ExecutionContext flow must run on the | ||
| // same thread where SuppressFlow was originally run. | ||
| using var _ = FlowControlHelper.TrySuppressFlow(); | ||
| return PerformTaskAsync(func, arg, _connectionPoolService.Scheduler.ConcurrentScheduler, cancellationToken); |
Contributor
There was a problem hiding this comment.
so, just for clarity. it's ok that we're going to return a task here, have the IDIsposable disposed, and hten have the caller to whatever it wants with that task? this is just about setting some values that are only relevant for when teh task is created?
Contributor
Author
There was a problem hiding this comment.
Yes, the behavior you describe is required for correctness. It's strange and normally a red flag, hence the warning.
Contributor
|
Is this a change that would be worthwhile to use inside the VS cache service, I wonder? |
dibarbet
pushed a commit
that referenced
this pull request
Jun 9, 2021
Suppress ExecutionContext flow on SQLite hot path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoids approximately 1 million calls to
LogicalCallContext.Clone(), which reduces GC and CPU overhead for this heavily asynchronous path.Fixes AB#1326123