4 ms·
It might. There are other optimizations for synchronization introduced around Java 1.6 after wisdom around StringBuilder was already common. I think it's still
by logn 10y ago
It might. There are other optimizations for synchronization introduced around Java 1.6 after wisdom around StringBuilder was already common. I think it's still safe to say StringBuilder at least can't hurt performance. More info: https://www.infoq.com/articles/java-threading-optimizations-p1 https://www.infoq.com/articles/java-threading-optimizations-...
Separately, it's interesting to me chained calls can be more efficient. Personally I prefer these longer, multi-line type of statements from a readability perspective. So I'm happy it happens to be efficient.