Cache provided types in the compiler
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
I propose we cache provided types on demand in the compiler itself.
Type providers commonly use caching to avoid regenerating types when static arguments remain the same. This significantly improves the responsiveness of Intellisense for heavy type providers. However, the back and forth facaded type conversions are still present. The situation is further exacerbated for generative type providers, where temporary assemblies need to be generated and written to disk *on every keystroke*.
Type provider authors should be able to indicate (via a parameter), that the compiler may cache provided types internally. The compiler would then retain the final, processed representations of provided types, and not call the type provider to apply (method or type) static arguments unless the latter have changed. Care would need to be taken in order to properly clean up unused data from caches to avoid memory leaks.
Related https://github.com/dotnet/fsharp/issues/4706, perhaps https://github.com/dotnet/fsharp/issues/5931.
Contributor guide
Assessment
This issue has not been assessed yet.