<Swing Dev> Replace concat String to append in StringBuilder parameters
Otávio Gonçalves de Santana
otaviojava at java.net
Sat Aug 30 13:12:45 UTC 2014
I believe yes.
Using the -XX:+OptimizeStringConcat:
java -jar -XX:+OptimizeStringConcat target/microbenchmarks.jar
".*StringBuilderConcatBenchMark.*" -wi 10 -i 10 -f 1
The same thing happened:
Benchmark Mode Samples
Mean Mean error Units
m.StringBuilderConcatBenchMark.stringBuilder thrpt 10
6316489.783 211751.479 ops/s
m.StringBuilderConcatBenchMark.stringBuilderWithConcat thrpt 10
3206244.215 60752.652 ops/s
So, can you review these changes, please.
https://bugs.openjdk.java.net/browse/JDK-8055723
http://cr.openjdk.java.net/~weijun/8055723/client/webrev.02/
http://cr.openjdk.java.net/~weijun/8055723/core/webrev.02/
http://cr.openjdk.java.net/~weijun/8055723/core/webrev.03/
On Fri, Aug 29, 2014 at 5:01 AM, Wang Weijun <weijun.wang at oracle.com> wrote:
> So it's not that the optimization fails but there is no optimization on
> them yet.
>
> I do see the .append("x") case will be easy to deal with, but it looks
> like historically javac has not been a place to do many optimizations. It
> mostly converts the java source to byte codes in a 1-to-1 mapping and let
> VM do whatever it wants (to optimize). When you talked about compiling
> multiple concatenation into using a single StringBuilder, it's more like
> choosing the correct implementation rather than an optimization.
>
> I don't expect to see big change on this in the near future, so shall we
> go on with the current enhancement?
>
> Thanks
> Max
>
> On Aug 29, 2014, at 2:17, Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:
>
> > I mean:
> > It does not output byte code that only uses a single char array to
> compose the entire String in question.
> > With "optimization fails", I also mean, there is used an additional
> "StringComposer" e.g. another StringBuilder or a StringJoiner in addition
> to the 1st StringBuilder.
> >
> > -Ulf
> >
> > Am 27.08.2014 um 14:02 schrieb Pavel Rappo:
> >> Could you please explain what you mean by "javac optimization fails"
> here?
> >>
> >> -Pavel
> >>
> >> On 27 Aug 2014, at 10:41, Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:
> >>
> >>> 4.) Now we see, that javac optimization fails again if StringBuilder,
> concatenation, toString(), append(String), append(Collection) etc. and
> StringJoiner use is mixed.
> >>
> >
>
>
--
Otávio Gonçalves de Santana
blog: http://otaviosantana.blogspot.com.br/
twitter: http://twitter.com/otaviojava
site: *http://about.me/otaviojava <http://about.me/otaviojava>*
55 (11) 98255-3513
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20140830/6d45163e/attachment.html>
More information about the swing-dev
mailing list