Optimize AddinDependsOn
Therzok opened this issue · 5 comments
A few problems are found in AddinDependsOn:
-
Each time we visit every addin, we don't save the visited data. Thus, on every scan, we re-create the visited table, visiting every addin more than once. In the case of 4 addins being loaded for one extension point, and 100 addins in the registry, we may well end up visiting all the nodes 400 times.
-
There's also the linear scan in place, not sure what other data structure could be used to remedy the issue there, as it is a chunked sorted list.
I'll give new stats after I eliminate the StartsWith hot code.
StartsWIth accounts for 863ms, probably will be lower when we use Ordinal comparison. Still, the root cause is in effect.
I'm taking a look at this, we might be able to do some effort trimming by reusing a tree structure for nodes that define dependencies.
Ughhh, GetAddinsForPath
does not use the path parameter, so this is why it might be showing up as pathological here.
Not a problem, disregard.
This kind of caching might not be useful to make at call level, but rather at ExtensionContext level, to define the addin dependency tree, by keeping it transient.