Code (Pre-)Review for JEP 280: Indify String Concat
aleksey.shipilev at oracle.com
Fri Nov 27 11:33:02 UTC 2015
Again, I'll post the updates after addressing another round of
Maurizio's comments :)
On 11/27/2015 10:47 AM, Andrej Golovnin wrote:
> 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().
More information about the core-libs-dev