Reuse command info cache during a PS session#695
Merged
kapilmb merged 2 commits intodevelopmentfrom Jan 24, 2017
Merged
Conversation
added 2 commits
January 23, 2017 15:44
This reverts commit 210d904. We revert this because, this allows the instance to persist through a powershell session across multiple pssa invocations. This is allows us to reuse the command info cache across multiple pssa invocations.
Since, helper is a singleton that persists through multiple pssa invocation, in a given powershell session, this helps us reuse the commandinfo cache created during the first pssa invocation. Results in significant perf improvement for subsequent pssa invocations.
daviwil
reviewed
Jan 24, 2017
| lock (syncRoot) | ||
| { | ||
| instance = value; | ||
| if (instance == null) |
Contributor
There was a problem hiding this comment.
Didn't this null check cause some other bug we saw recently?
Author
There was a problem hiding this comment.
Yes it did cause some issue earlier - Get-ScriptAnalyzer command would instantiate Helper.Instance to new Helper() and when Invoke-ScriptAnalyzer would try to set the instance again, it would ignore the setter, which cause Invoke-ScriptAnalyzer to crash.
But after adding this, that bug was resolved and the removing this null check was redundant.
daviwil
approved these changes
Jan 24, 2017
Author
|
Thanks @daviwil |
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.
Before
After
This change is