This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Actually, StringBuilder requires a copy of the data, whereas if youWhy couldn't StringBuilder do sharing with copy-on-write, like java.lang.StringBuffer does? If it did this, any difference between gnu.gcj.runtine.StringBuffer and StringBuilder would be negligible, and we could switch to using StringBuilder everywhere.
use gnu.gcj.runtime.StringBuffer, no copy is made. StringBuilder
requires a copy since, in the absence of escape analysis, you don't
know that the user won't reset it and reuse the buffer.
Per> For CNI code it would be even better to use a stack-allocated Per> "RawStringBuilder" struct:
When compiling from source, gcj uses gnu.gcj.runtime.StringBuffer to
implement String concatenation; we could change it to stack allocate
this too.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |