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
More information about the core-libs-dev
mailing list