On Wed, 14 Apr 2021 20:03:27 GMT, Claes Redestad <redes...@openjdk.org> wrote:

> There's a StringJoinerBenchmark micro added by JDK-8148937 which could 
> perhaps be expanded with the scenarios you've experimented with here?

I modified that micro benchmark and added a method to also measure String.join 
static method along with StringJoiner for same parameters and extended the 
range of parameters to cover more diversity. The results are here:

https://jmh.morethan.io/?gist=c38cc13d63774ec505cc8d394c00d502

It is apparent that there is a huge speedup when strings are bigger. But even 
smaller strings get a substantial speedup. There's also substantial reduction 
of garbage per operation. Previously the garbage amounted to the internal array 
of String elements and the StringBuffer with its internal byte[] array of 
characters. Now only the array of elements is the garbage.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3501

Reply via email to