3 ms·
The code creates unique strings to "interns" which most likely isn't what would happen in a real world application (unless you know... code without thought), yo
by TheGuyWhoCodes 9y ago
The code creates unique strings to "interns" which most likely isn't what would happen in a real world application (unless you know... code without thought), you'd inter strings with low variance usually.
Not saying that it won't be slower but the memory usage might be lower.
- wtetzner 9y agoYeah, blindly interning strings isn't a good idea, but it can be useful for certain use cases. For example, keys of maps where you know the keys won't vary much. It can reduce memory usage, and improve lookup performance (since doing a lookup requires a string comparison).