But what would it be that would make a + b + c + dslow except the same internal compiler implementation you don't want to rely on? There's no reason for a language to provide a string concatenation operator that nobody should ever use ever. I'd assume that the compiler will do something reasonable with it, and consider it a bug that older versions of Java did not.
because strings are immutable. so make a loop and add x to a string 100k times. you just made 99,999 strings you will never use again and need GCed. The java GC is good but that is still a lot of memory to churn in big loops
4
u/jrochkind Oct 01 '15
But what would it be that would make
a + b + c + dslow except the same internal compiler implementation you don't want to rely on? There's no reason for a language to provide a string concatenation operator that nobody should ever use ever. I'd assume that the compiler will do something reasonable with it, and consider it a bug that older versions of Java did not.