-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Create an internal sorted equatable collection type for incremental source generators #89318
Comments
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsBased on feedback from @eiriktsarpalis.
An upcoming PR to enable incremental generation for the config binding generator (#83534) will share this type, and also needs to sort elements before construction. As a follow up to that PR, we should create a new type (say
|
For simplicity we might just call it |
Can we get an oob nuget package with the sources of such collections as content files? At the moment most src gens simply copy the Array type around or fail to understand that they are practically necessary for proper caching. Why Nuget with source files as content? Binary Nugets with src gens are quite complicated to get them working properly. |
We should definitely consider something like this eventually, once the proposed new types have been tried and tested internally. |
@jkoritzinsky Any possibility to share with the interop source generators? |
We have a collection today that has this behavior, |
Yeah I've been usig my own Worth noting — that's just one of the many missing APIs you have to manually polyfill every single time you're writing a generator, but this one in particular feels like something should really just be built-in, as it's also perf-critical 😅 |
Moving out all the incremental source gen work to 10.0 |
FWIW I've been using equatable sets and dictionaries with success in typeshape-csharp: |
Based on feedback from @eiriktsarpalis.
ImmutableEquatableArray<T>
implements sequence equality. The JSON generator uses it in its specs to make incremental generation possible. However, spec collections often need to have set-like semantics to retain equality & avoid regeneration when there are compilation diffs that don't affect the effective inputs to the generator. IOW we want to avoid false negatives in the incremental cache.An upcoming PR to enable incremental generation for the config binding generator (#83534) will share this type. As a follow up to that PR, we should create a new type (say
ImmutableEquatableSet<T>
) that guarantees set semantics by construction, following the implementation ofSortedList<T>
. This would avoid false negatives in the incremental cache.The text was updated successfully, but these errors were encountered: