Closed ubaid4j closed 4 years ago
@UbaidurRehman1 starting with Java 9, concatenation is on par with StringBuilder in most cases (as it will be translated to StringBuilder usage at runtime). See https://openjdk.java.net/jeps/280
But even without that, it's only important for code that runs multipe times (what is often called code in the hot path). Here is code that will run once in a test to display the result so it not worth it the optimization.
Nice Explanation, Great.
So I just checked this class
org/quickperf/jvm/jmc/value/DisplayJvmProfilingValueVerifier.java
and it has a concatenation which is given below:So, Can I change it to String Builder (or Buffer in case if it is multi-threaded) cause concatenation is not good for performance wise?