On Tue, 12 Apr 2022 20:39:52 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> Without specific information about use cases, there isn't enough information 
> to craft a good algorithm/solution and simplicity is preferred. The 
> MAX_SKIP_BUFFER_SIZE is 2048 (not 8192).
> 
> What subclasses of InputStream in the JDK do not override skip(n)? Most 
> sequential streams are open for a relatively short period of time, the 
> lifetime of the memory for the buffer won't change the memory usage enough to 
> notice.
> 
> If the concern is about tying up memory then allocate the buffer once and 
> don't resize it. Each resize consumes extra memory and gc cycles to reclaim 
> the last buffer. Use the requested size but at least nnn and at most 
> MAX_SKIP_BUFFER_SIZE.

@RogerRiggs Sounds reasonable and applied. Should we change the implementation 
in Reader class as well?

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

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

Reply via email to