8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char

Claes Redestad claes.redestad at oracle.com
Thu Feb 21 13:25:27 UTC 2019

On 2019-02-21 14:12, Alan Bateman wrote:
> On 21/02/2019 10:31, Claes Redestad wrote:
>> Hi Brian,
>> patch looks good to me, but the new implementation will throw
>> BufferOverflowException before writing anything to the buffer, whereas
>> the old one would fill up the CharBuffer.
> Which case (CharBuffer sub-class) do you see this? The CharBuffer 
> put(String, ...) methods are specified to throw BufferOverflowException 
> and the implementation should be throwing this before copying any chars 
> into the buffer.

My bad, I based my faulty reasoning on the code in the bug rather than
the existing template. Seems there's no observable difference in 
behavior here.


More information about the nio-dev mailing list