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

Brian Burkhalter brian.burkhalter at oracle.com
Thu Feb 21 15:54:32 UTC 2019


> On Feb 21, 2019, at 5:25 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
> 
> 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.

Thanks for the comments. Should I consider this patch to have been reviewed?

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190221/fc79fe55/attachment.html>


More information about the nio-dev mailing list