New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using java.lang.StringBuilder in the translation of String contatentation #9315
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9315?orig=1 |
@retronym said: |
@dragos said: |
@ijuma said: "However, it turns out there is an very important but underdocumented jvm optimization, OptimizeStringConcat, which is enabled by default. This optimization, which is pretty much only documented by its source code (http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/opto/stringopts.cpp), is capable of turning something of approximately the form new StringBuilder().append(x).append(y)....append(z).toString() (aka about what javac would generate if you use x + y + ... + z) into a single char[] allocation of the optimal length, which is a big performance boost over what the normal java code does (2 char[] allocations at the absolute minimum if the initial size is correct, normally more) https://groups.google.com/d/msg/scala-language/AN2Ymk1J1ik/Tpq9vpQCIQAJ |
@soc said: |
@ijuma said: |
The text was updated successfully, but these errors were encountered: