RFR [8054221] StringJoiner imlementation optimization

Claes Redestad claes.redestad at oracle.com
Mon Aug 4 17:04:13 UTC 2014


Hi,

  - is there a sufficiently good reason not to use an ArrayList<String> 
over a manually resized String[] here? It'd simplify and use 
overflow-conscious code at a negligible performance cost
  - nit: elt(s) -> element(s)
  - nit: always use curly braces

/Claes

On 08/04/2014 06:16 PM, Ivan Gerasimov wrote:
> Hello!
>
> Here's the proposal by Martin Buchholz to improve implementation of 
> StringJoiner class:
> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/StringJoiner-optimization/ 
>
>
> I think that result of concatenation in the merge() method can be 
> saved to be reused later.
> This would be useful, for example, if a StringJoiner is merged into 
> other StringJoiners several times.
>
> So, here's my slightly modified version of the Martin's webrev:
> http://cr.openjdk.java.net/~igerasim/8054221/0/webrev/
>
> I've also modified the test to regularly test cases with empty 
> prefixes/suffixes.
>
> Sincerely yours,
> Ivan




More information about the core-libs-dev mailing list