RFR (XS) 8076759: AbstractStringBuilder.append(...) should ensure enough capacity for the upcoming "trivial" append calls

Bernd Eckenfels ecki at zusammenkunft.net
Fri May 1 19:14:34 UTC 2015


Hello,

btw just a small - maybe unrelated - observation on stock Java8u40. When
benchmarking String.valueOf/Integer.toString/""+n with JMH I noticed
that the compiler aided concatenation is the fastest, but not for all
integer values. I asume this is related with the initial size of the
buffer?

https://gist.github.com/ecki/399136f4fd59c1d110c1

Gruss
Bernd

 Am Fri, 01 May
2015 13:19:11 -0400 schrieb Roger Riggs <Roger.Riggs at Oracle.com>:

> Hi Aleksey,
> 
> Is there any additional benefit by rounding up the next multiple of 4
> or 8. That would avoid a few wasted bytes at the end of the buffer
> modulo the allocation size.
> 
> Otherwise, looks fine to me also.



More information about the core-libs-dev mailing list