Code (Pre-)Review for JEP 280: Indify String Concat

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Nov 27 11:33:02 UTC 2015


Hi,

Again, I'll post the updates after addressing another round of
Maurizio's comments :)

On 11/27/2015 10:47 AM, Andrej Golovnin wrote:
>>   http://cr.openjdk.java.net/~shade/8085796/webrev.langtools.02/
> 
> test/tools/javac/T5024091/T5024091.java
> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java
> 
> The files do not have the copyright header.

Thanks again, added.


> And I have one stupid question to com.sun.tools.javac.jvm.StringConcat:
> 
> The constants TAG_ARG and TAG_CONST are defined as Strings. From
> performance standpoint of view, would it be not better to use char
> instead of String?
> 
> I understand that:
> 
> if (a.contains(TAG_CONST) || a.contains(TAG_ARG))
> 
> is easier to read than:
> 
> if (a.indexOf(TAG_CONST) != -1 || a.indexOf(TAG_ARG) != -1)
> 
> But when you have a huge project to compile, maybe it can help to
> reduce the compile time.

Yes, it might makes sense to do this microoptimization. Done.


> The line 330 in com.sun.tools.javac.jvm.StringConcat:
> 
> 330                 recipe.append("null");
> 
> Maybe it is better to rewrite it as:
> 
> 330                 recipe.append((String) null);

> The first one requires to copy byte values from the "null" String. The
> second one ends up in the call to AsbtractStringBuilder.appendNull().

Ditto.

Thanks,
-Aleksey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20151127/2d33f3fd/signature.asc>


More information about the compiler-dev mailing list