Simple and safe performance changes to package load code.#77561
Simple and safe performance changes to package load code.#77561ToddGrun merged 3 commits intodotnet:release/dev18.0from
Conversation
|
|
||
| protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) | ||
| { | ||
| await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); |
|
|
||
| await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); | ||
|
|
||
| _componentModel_doNotAccessDirectly = (IComponentModel?)await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); |
|
|
||
| protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) | ||
| { | ||
| await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); |
|
|
||
| await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); | ||
|
|
||
| cancellationToken.ThrowIfCancellationRequested(); |
|
|
||
| protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) | ||
| { | ||
| await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); |
| try | ||
| { | ||
| await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); | ||
| await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); |
There was a problem hiding this comment.
do we need/want CA(true) on the prior line? if so, doc.
There was a problem hiding this comment.
no, we don't want that either, I just missed it in this PR. I'll go ahead and change.
There was a problem hiding this comment.
doc that as well plz
| Protected Overrides Async Function InitializeAsync(cancellationToken As CancellationToken, progress As IProgress(Of ServiceProgressData)) As Task | ||
| Try | ||
| Await MyBase.InitializeAsync(cancellationToken, progress).ConfigureAwait(True) | ||
| Await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken) |
There was a problem hiding this comment.
do we need/want CA(true) on the prior line? if so, doc.
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
signing off. but i think it wouild be good for these critical sections to doc the intentional behavior here.
Agreed, I will add some documentation once things get a little closer to the end target. |
| _componentModel_doNotAccessDirectly = (IComponentModel?)await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); | ||
| _componentModel_doNotAccessDirectly = (IComponentModel?)await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(false); | ||
| Assumes.Present(_componentModel_doNotAccessDirectly); | ||
|
|
There was a problem hiding this comment.
nit: feel free to do in a follow up
There was a problem hiding this comment.
whoops! I had a whole bunch of logging that I was using for local verification, and looks like I didn't remove the newline that I had next to it.
This is the 2nd part of a multi-part PR series focused on improving the performance of loading the roslyn packages.
This PR focuses mostly on removing some extraneous potential thread switches.
Part 1: #77439