Adapter lookup table for non-list operations on adapted resources#530
Merged
SteveL-MSFT merged 35 commits intoPowerShell:mainfrom Sep 16, 2024
Merged
Adapter lookup table for non-list operations on adapted resources#530SteveL-MSFT merged 35 commits intoPowerShell:mainfrom
SteveL-MSFT merged 35 commits intoPowerShell:mainfrom
Conversation
added 4 commits
August 23, 2024 23:34
aea50e2 to
2872f03
Compare
added 9 commits
August 27, 2024 14:16
…C-New into adapter_lookup_table
SteveL-MSFT
requested changes
Aug 30, 2024
SteveL-MSFT
requested changes
Sep 6, 2024
added 4 commits
September 16, 2024 12:24
SteveL-MSFT
requested changes
Sep 16, 2024
SteveL-MSFT
approved these changes
Sep 16, 2024
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
This is a performance optimization that reduces time when searching for the adapter that implements a requested resource when non-list operations on this resource are invoked.
When a non-list operation on an adapted resource is invoked (e.g.
dsc resource get -r Test/TestCase), discovery code first is doingListoperation sequentially on all adapters until it finds which adapter implements requested resource.If the adapter of interest happens to be in the end of line, then a huge perf cost is accumulated.
This change adds an adapter lookup table that is basically a mapping
<resource type>-><was last seen in this adapter>.This lookup table is then used for sorting adapter list before doing
Listoperations on them, this way the adapter of interest is searched first, reducing overall time of operation.Adapter lookup file location:
$env:LocalAppData+"dsc\AdaptedResourcesLookupTable.json"$env:HOME+".dsc/AdaptedResourcesLookupTable.json"PR Context
Before change:
After change: