Create JumpList in background thread to improve performance#6985
Merged
iSazonov merged 5 commits intoPowerShell:masterfrom Jun 5, 2018
Merged
Create JumpList in background thread to improve performance#6985iSazonov merged 5 commits intoPowerShell:masterfrom
iSazonov merged 5 commits intoPowerShell:masterfrom
Conversation
… when pwsh owns the window (i.e. when the Jumplist has to be created)
…o JumpListPerformanceOptimisation
iSazonov
reviewed
Jun 4, 2018
|
|
||
| #if !UNIX | ||
| Microsoft.PowerShell.TaskbarJumpList.CreateElevatedEntry(ConsoleHostStrings.RunAsAdministrator); | ||
| Task.Run(() => TaskbarJumpList.CreateElevatedEntry(ConsoleHostStrings.RunAsAdministrator)); |
Collaborator
There was a problem hiding this comment.
Maybe move this in line 217? Code before the line do return and fast exit..
…ight make it exit earlier as suggested in PR review by @iSazonov
TravisEz13
approved these changes
Jun 4, 2018
anmenaga
approved these changes
Jun 4, 2018
anmenaga
left a comment
There was a problem hiding this comment.
I would recommend adding a comment before this code line - a brief version of what is written in "PR Summary": about saving 55ms, about dependency of a jump list on file path and about absence of 'Get' API...
Collaborator
|
@bergmeister Please address @anmenaga comment and we'll be ready to merge. |
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.
PR Summary
Background/Recap: PR #6913 added a JumpList on Windows only and already made sure that in case of pwsh being non-interactive or not being the owner of the current window, the algorithm aborts as early as possible (<1ms) but in cases when the JumpList needs to be created, the work in the ConsoleHost is done synchronously and takes around 55ms.
This PR enhances the last scenario by eliminating the blocking time completely by doing the work in a background thread without waiting for it and as suggested in the PR review, moving it to a later stage.
Some more info: Once the JumpList is being set the first time, it will persist (if the file path remains the same), therefore it is OK to move it to a later stage in general. As already discussed there is no 'GET' API to check whether the JumpList needs to be created or not. In theory, one could possibly even try to call it in a WiX custom action during the installation but even if that worked, I am questioning its persistence e.g. during one of the bi-annual Windows updates (personally, I have seen e.g. that registry keys, etc. do not get persisted). Therefore I think this optimisation makes it polished enough to not worry about those few extra CPU cycles, especially since Windows deployments nowadays usually have multi-core CPUs as well.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests