String Interning - To Use or Not to Use? A Performance Question
- String interning in non-native AOT is very slow and can drastically affect your application performance.
- If you call string.Intern in your code you probably should think if you really should.
- A very naive custom string cache based on ConcurrentDictionary<string, string> is drastically faster then the string interning cache and gives you an opportunity to clean-up the cache.
- If your app runs as a Native AOT app, then the performance is good, and the only drawback of the bulit-in string interning is an inability to clean it.
https://sergeyteplyakov.github.io/Blog/benchmarking/2023/12/10/Intern_or_Not_Intern.html
#interning
Post #2343
664