Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> As noted a paragraph later, the Java compiler is able to detect and “fix” this, by rewriting the code to use a mutable string.

Does it actually do that nowadays? Back in my days it was incapable of lifting the builder out of loops, so for each iteration it would instantiate a builder with the accumulator string, append the concatenation, then stringify and reset the accumulator.

The linked docs don’t say anything about loops.



I agree. If you append to a string in a loop in Java, you will see quadratic behavior.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: