-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate CSharpAvoidUninstantiatedInternalClasses
performance
#6301
Comments
Note that this rule is disabled by default though: Line 30 in 2928b85
|
For the repo I got the binlog from, I have aggressively enabled all performance analyzers. The code snippet I posted above is probably not the cause of performance issues. The semantic model is used only if there is a using directive of the form #6309 is a possible improvement. Another thing worth looking at is: Lines 116 to 119 in e22457d
Here we try to add I know that For example: public class C { }
public class C1 : C { }
public class C2 : C { }
public class C3 : C { } If we analyze C1, C2, C3 concurrently, we'll call While I can't think of a way to avoid this for the above case, it can be avoided if the base type doesn't belong to The very common scenario is when the base type is NOTE: All this is just guessing. I haven't profiled. |
startContext.RegisterOperationAction(context =>
{
var expr = (IObjectCreationOperation)context.Operation;
if (expr.Type is INamedTypeSymbol namedType)
{
instantiatedTypes.TryAdd(namedType, null);
}
}, OperationKind.ObjectCreation); This also might be a problem, if there are too many object creations of types not in current assembly, |
In a binlog I was looking at, noticed:
It might be caused by SemanticModel usage below?
roslyn-analyzers/src/NetAnalyzers/CSharp/Microsoft.CodeQuality.Analyzers/Maintainability/CSharpAvoidUninstantiatedInternalClasses.cs
Lines 18 to 31 in 44af587
Can this be improved?
cc @sharwell @mavasani
The text was updated successfully, but these errors were encountered: