-
Notifications
You must be signed in to change notification settings - Fork 571
Improve caching in XmlToDescriptionGenerator #1010
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
base: main
Are you sure you want to change the base?
Conversation
| ImmutableArray<string> TypeParameters, ImmutableArray<ParameterInfo> Parameters, | ||
| string? MethodDescription, string? ReturnDescription, ImmutableArray<DiagnosticInfo> Diagnostics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Immutable array is likely to hurt equality here. I personally always reuse EquatableArray from @Sergio0694 for this. https://github.com/Sergio0694/ComputeSharp/blob/main/src/ComputeSharp.SourceGeneration/Helpers/EquatableArray%7BT%7D.cs
| private readonly record struct DiagnosticInfo(string Id, Location? Location, params object?[] MessageArgs); | ||
|
|
||
| /// <summary>Holds extracted XML documentation for a method.</summary> | ||
| private sealed record XmlDocumentation(string MethodDescription, string Returns, Dictionary<string, string> Parameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Dictionary should still be a problem, isn't it?
| private readonly record struct MethodToGenerate(MethodDeclarationSyntax MethodDeclaration, IMethodSymbol MethodSymbol); | ||
| private readonly record struct TypeDeclarationInfo(string Name, string TypeKeyword); | ||
|
|
||
| private readonly record struct DiagnosticInfo(string Id, Location? Location, params object?[] MessageArgs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This array here is likely to be a problem as well?
| // Combine with compilation to get well-known type symbols. | ||
| var compilationAndMethods = context.CompilationProvider.Combine(allMethods); | ||
| // Report diagnostics. | ||
| context.RegisterSourceOutput(allMethods, static (spc, methods) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This separation of diagnostic reporting into a separate callback is an interesting approach. I think it might provide a viable workaround for dotnet/runtime#92509. Curious if you've applied this approach elsewhere before, or if there are any drawbacks to it.
Closes #1003