Hi there,
This is a non-gameprogramming-and-although-java-still-off-topic-question ™ ::)
I read that Strings literals are stored in an internal pool of unique String values.
This implies that every next String literal you have, takes longer to be created because it needs to check if there is another literal String instance in the pool with the same value.
Is this really true? Doesn’t this also indirectly imply that the bigger your program gets, string literals get slower?
I found this somewhat disturbing, but I don’t know how this impacts real-life programs: I could also imagine that it could in fact be faster in real-life programs than with String being a primitive like C (although I could also imagine that if this is in fact true, such optimizations can be done at compile time in C).
Has someone done tests/has experience with this? (if not, I’ll might do it myself).
Greetings,
Erik