String concatenation tweaks
aleksey.shipilev at oracle.com
Thu Mar 12 08:34:04 UTC 2015
I am not really fond of doing the optimizations on javac level: asking
users to recompile their programs for better performance and/or fixing
the (probable) javac bugs is arguably against what users expect.
But in this case, changing the bytecode shape before hitting the JIT
compiler seems to be the sanest route. JIT compilers have to maintain
more strong invariants than most users let on, see e.g.:
On 03/12/2015 12:01 AM, Louis Wasserman wrote:
> * While we were at it, in the case of two arguments that are
> statically known to be Strings, our benchmarks show String.concat to
> be firmly more efficient than the StringBuilder, even in the
> presence of flags like -XX:+OptimizeStringConcat. This is arguably
> a separate optimization, but nonetheless effective; our benchmarks
> at the time suggested 40% CPU improvements and 60% fewer bytes
> allocated relative to the status quo.
I agree, this is a separate issue, probably against the JIT compiler itself.
> If these suggestions (and performance numbers) are of interest, I can
> port our patch for upstream use.
I am interested in this patch, pending the evaluation order questions
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the compiler-dev