3 ms·
This is a quite embarrassing bug because it affects probably the most used class in Java. However I think using += for the Strings is not that popular among ex
by didymospl 8y ago
This is a quite embarrassing bug because it affects probably the most used class in Java.
However I think using += for the Strings is not that popular among experienced developers because they want to be sure that no unnecessary Strings are created in the pool.
I assume the execution times would be similar with the optimizations you mentioned, but according to Effective Java(3rd edition, published this year) using += for Strings in the loop is still 6,5 times slower than using StringBuilder. I need to check it myself.
- on_and_off 8y agoAFAIK the compiler already uses a builder for you. At least on Android, but I believe this optim is in javac, not in the dexer.