Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-30 Thread Alan Bateman
On Mon, 30 May 2022 05:29:01 GMT, Alan Bateman wrote: >> More practically. >> This PR has a noticeable negative effect - it increases the size of >> InputStream objects. Moreover, it increases the size of InputStream >> subclasses which has own skip() implementation and don't need this >> supe

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-30 Thread XenoAmess
On Mon, 30 May 2022 05:29:01 GMT, Alan Bateman wrote: > However, I think your suggestion to change the no-arg read/write be > non-abstract is interesting as it's always a pain to have to implement that. @AlanBateman this need a csr IMO? - PR: https://git.openjdk.java.net/jdk/pull

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-29 Thread Alan Bateman
On Sun, 29 May 2022 18:15:52 GMT, Sergey Kuksenko wrote: > 5. skip() is not implemented, when not-so-trivial implementation is possible > (9 classes): For the low-level streams (e.g. connected to socket) then it would be common to see them wrapped by buffered streams. So it might not be worth

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-29 Thread XenoAmess
On Sun, 29 May 2022 18:23:03 GMT, Sergey Kuksenko wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> invert if; refine javadoc. > > Another InputStreams cleaning direction. > > Many InputStream subclasses have read(byte

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-29 Thread Sergey Kuksenko
On Tue, 24 May 2022 20:40:51 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > invert if; refine jav

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-29 Thread Sergey Kuksenko
On Tue, 24 May 2022 20:40:51 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > invert if; refine jav

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-29 Thread Sergey Kuksenko
On Thu, 26 May 2022 15:43:57 GMT, XenoAmess wrote: > > Is there any practical scenario where the current code (skip buffer > > allocation on each invocation) creates issues? > > @kuksenko Not found any yet :) In that case, what is the value of this PR? Do we need a code change for the sake of

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-26 Thread XenoAmess
On Wed, 25 May 2022 23:23:13 GMT, Sergey Kuksenko wrote: > Is there any practical scenario where the current code (skip buffer > allocation on each invocation) creates issues? @kuksenko Not found any yet :) - PR: https://git.openjdk.java.net/jdk/pull/5872

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-25 Thread Sergey Kuksenko
On Tue, 24 May 2022 20:40:51 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > invert if; refine jav

Re: RFR: 8284638: store skip buffers in InputStream Object [v12]

2022-05-24 Thread XenoAmess
On Fri, 20 May 2022 21:15:23 GMT, Roger Riggs wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add documents > > src/java.base/share/classes/java/io/InputStream.java line 78: > >> 76: SoftReference ref = this.

Re: RFR: 8284638: store skip buffers in InputStream Object [v15]

2022-05-24 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: invert if; refine javadoc. - Changes: - all: https://git.openjdk.java

Re: RFR: 8284638: store skip buffers in InputStream Object [v14]

2022-05-24 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: refine javadoc, remove The "notice..." statement - Changes: - all: ht

Re: RFR: 8284638: store skip buffers in InputStream Object [v12]

2022-05-24 Thread XenoAmess
On Fri, 20 May 2022 21:08:51 GMT, Roger Riggs wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add documents > > src/java.base/share/classes/java/io/InputStream.java line 72: > >> 70: * >> 71: * @param size

Re: RFR: 8284638: store skip buffers in InputStream Object [v13]

2022-05-24 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: rename function skipBufferReference to skipBuffer - Changes: - all: h

Re: RFR: 8284638: store skip buffers in InputStream Object [v12]

2022-05-24 Thread XenoAmess
On Fri, 20 May 2022 21:05:07 GMT, Roger Riggs wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add documents > > src/java.base/share/classes/java/io/InputStream.java line 75: > >> 73: * @return the byte array. >>

Re: RFR: 8284638: store skip buffers in InputStream Object [v12]

2022-05-20 Thread Roger Riggs
On Wed, 20 Apr 2022 16:52:31 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > add documents src/ja

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-05-20 Thread XenoAmess
On Wed, 20 Apr 2022 16:36:16 GMT, XenoAmess wrote: >>> no, we use other way, but yes for we take care of thread safety. >> >> Fair enough. >> >>> Don't think it necessary... I think making it cannot touched by other >>> object (with security manager on) is enough. >> >> I was thinking more fo

Re: RFR: 8284638: store skip buffers in InputStream Object [v12]

2022-04-20 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: add documents - Changes: - all: https://git.openjdk.java.net/jdk/pull

Re: RFR: 8284638: store skip buffers in InputStream Object [v9]

2022-04-20 Thread XenoAmess
On Wed, 20 Apr 2022 16:35:25 GMT, liach wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> remove uselsee MIN_SKIP_BUFFER_SIZE > > src/java.base/share/classes/java/io/InputStream.java line 62: > >> 60: >> 61: priva

Re: RFR: 8284638: store skip buffers in InputStream Object [v11]

2022-04-20 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: skipBufferReference(long) -> skipBufferReference(int) - Changes: - al

Re: RFR: 8284638: store skip buffers in InputStream Object [v9]

2022-04-20 Thread liach
On Wed, 20 Apr 2022 16:30:19 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > remove uselsee MIN_SK

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-20 Thread XenoAmess
On Tue, 19 Apr 2022 22:37:21 GMT, jmehrens wrote: >>> > @jmehrens what about this then? I think it safe now(actually this >>> > mechanism is learned from Reader) >>> >>> Reader uses a lock object and it appears that InputStream locks on this >>> (per make/reset) I would assume now that you hav

Re: RFR: 8284638: store skip buffers in InputStream Object [v10]

2022-04-20 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: comment added. - Changes: - all: https://git.openjdk.java.net/jdk/pul

Re: RFR: 8284638: store skip buffers in InputStream Object [v8]

2022-04-20 Thread XenoAmess
On Wed, 20 Apr 2022 16:16:05 GMT, liach wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> remove useless skipBuffer > > src/java.base/share/classes/java/io/InputStream.java line 57: > >> 55: private static final in

Re: RFR: 8284638: store skip buffers in InputStream Object [v9]

2022-04-20 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: remove uselsee MIN_SKIP_BUFFER_SIZE - Changes: - all: https://git.ope

Re: RFR: 8284638: store skip buffers in InputStream Object [v8]

2022-04-20 Thread liach
On Wed, 20 Apr 2022 16:07:17 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > remove useless skipBu

Re: RFR: 8284638: store skip buffers in InputStream Object [v8]

2022-04-20 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: remove useless skipBuffer - Changes: - all: https://git.openjdk.java.

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-20 Thread XenoAmess
On Tue, 19 Apr 2022 22:47:42 GMT, liach wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> change to liach operation. > > src/java.base/share/classes/java/io/InputStream.java line 62: > >> 60: >> 61: /** Skip buffe

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-19 Thread liach
On Fri, 15 Apr 2022 18:56:37 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > change to liach opera

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-19 Thread jmehrens
On Tue, 19 Apr 2022 18:04:03 GMT, XenoAmess wrote: > no, we use other way, but yes for we take care of thread safety. Fair enough. > Don't think it necessary... I think making it cannot touched by other object > (with security manager on) is enough. I was thinking more for heapdumps due to ex

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-19 Thread liach
On Tue, 19 Apr 2022 18:04:03 GMT, XenoAmess wrote: > Reader uses a lock object and it appears that InputStream locks on this (per > make/reset) I would assume now that you have some object member fields you > need to hold some lock while accessing those. Even though single thread > access woul

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-19 Thread XenoAmess
On Mon, 18 Apr 2022 20:08:23 GMT, jmehrens wrote: > > @jmehrens what about this then? I think it safe now(actually this mechanism > > is learned from Reader) > > Reader uses a lock object and it appears that InputStream locks on this (per > make/reset) I would assume now that you have some obj

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-18 Thread jmehrens
On Fri, 15 Apr 2022 18:56:37 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > change to liach opera

Re: RFR: 8284638: store skip buffers in InputStream Object [v7]

2022-04-15 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: change to liach operation. - Changes: - all: https://git.openjdk.java

Re: RFR: 8284638: store skip buffers in InputStream Object [v6]

2022-04-14 Thread liach
On Thu, 14 Apr 2022 18:52:25 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > refine jmh Now this

Re: RFR: 8284638: store skip buffers in InputStream Object [v5]

2022-04-14 Thread XenoAmess
On Thu, 14 Apr 2022 17:41:38 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > refine jmh Jmh Resu

Re: RFR: 8284638: store skip buffers in InputStream Object [v6]

2022-04-14 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: refine jmh - Changes: - all: https://git.openjdk.java.net/jdk/pull/58

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-14 Thread XenoAmess
On Wed, 13 Apr 2022 22:59:13 GMT, liach wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add jmh > > test/micro/org/openjdk/bench/java/io/InputStreamSkipBenchmark.java line 54: > >> 52: @Benchmark >> 53: publi

Re: RFR: 8284638: store skip buffers in InputStream Object [v5]

2022-04-14 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: refine jmh - Changes: - all: https://git.openjdk.java.net/jdk/pull/58

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-14 Thread XenoAmess
On Wed, 13 Apr 2022 15:09:27 GMT, Roger Riggs wrote: >>> I recommend moving `nr` declaration from the beginning of the method to >>> where it's actually used (here) >> >> @liach done. > > Sorry, I misunderstood your earlier comment: "Sounds reasonable and applied" > as concurring with not re-al

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-14 Thread XenoAmess
On Wed, 13 Apr 2022 22:53:11 GMT, liach wrote: > I suggest we actually write into the byte array to better simulate overheads > (maybe by generating a number with `ThreadLocalRandom`). This sounds reasonable, as each InputStream implementation always need to copy it. > To simulate overhead on

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-14 Thread XenoAmess
On Tue, 12 Apr 2022 23:35:06 GMT, liach wrote: > Shouldn't be too problematic, as most skip usages in JDK as I see are > skipping small number of bytes like 2 or 4, or like skipping over attributes > of Java class files. A minimum skip buffer size isn't that helpful, as I > don't think we ofte

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-14 Thread XenoAmess
On Thu, 14 Apr 2022 15:33:40 GMT, Roger Riggs wrote: > > Why as it already be a unacceptable option for security reason? > > A shared (static) buffer would be visible to application controlled > subclasses when the `read(buffer, 0, len)` method is called. The subclass > could examine the buffe

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-14 Thread XenoAmess
On Thu, 14 Apr 2022 15:36:20 GMT, Roger Riggs wrote: > Can you summarize the performance results and implications. Including the > whole jmh run isn't necessary. @RogerRiggs In short, making such a cache can help performance, and the larger int skip length people call `skip()`, the larger dif

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-14 Thread Roger Riggs
On Wed, 13 Apr 2022 21:58:06 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > add jmh Can you summ

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-14 Thread Roger Riggs
On Thu, 14 Apr 2022 04:09:48 GMT, XenoAmess wrote: > Why as it already be a unacceptable option for security reason? A shared (static) buffer would be visible to application controlled subclasses when the `read(buffer, 0, len)` method is called. The subclass could examine the buffer and see dat

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-13 Thread XenoAmess
On Thu, 14 Apr 2022 02:21:23 GMT, Bernd Eckenfels wrote: > If you consider doing benchmarks in detail maybe consider a static buffer, > too? (Especially if it can be used in multiple implementations?) Why as it already be a unacceptable option for security reason? - PR: https://g

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Bernd Eckenfels
, 2022 11:58:06 PM An: core-libs-dev@openjdk.java.net Betreff: Re: RFR: 8284638: store skip buffers in InputStream Object [v2] On Wed, 13 Apr 2022 16:02:10 GMT, Alan Bateman wrote: >>> @AlanBateman You are correct about this. But I wonder if this be a problem, >>> why Reader class

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-13 Thread liach
On Wed, 13 Apr 2022 21:58:06 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > add jmh test/micro/o

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > moving nr declaration

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 16:02:10 GMT, Alan Bateman wrote: >>> @AlanBateman You are correct about this. But I wonder if this be a problem, >>> why Reader class can afford store a skip buffer for each Reader. >>> >>> Is there anything different in the situations about skipBuffer in Reader >>> and In

Re: RFR: 8284638: store skip buffers in InputStream Object [v4]

2022-04-13 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: add jmh - Changes: - all: https://git.openjdk.java.net/jdk/pull/5872/

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread Roger Riggs
On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > moving nr declaration

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Alan Bateman
On Wed, 13 Apr 2022 15:03:22 GMT, Alan Bateman wrote: >> This change may be problematic for servers with a large number connections >> and an input stream for each connection. It could add up to 2k to the >> footprint of each connection when skip is used. > >> @AlanBateman You are correct abou

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > moving nr declaration

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread liach
On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > moving nr declaration

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 15:23:16 GMT, XenoAmess wrote: > > On a side note for unifying the skip buffer implementation of reader vs > > input stream: For the input stream subclasses in the JDK that have their > > own skip with buffering logic (as described in > > https://github.com/openjdk/jdk/pull

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 15:20:06 GMT, liach wrote: > On a side note for unifying the skip buffer implementation of reader vs input > stream: For the input stream subclasses in the JDK that have their own skip > with buffering logic (as described in > https://github.com/openjdk/jdk/pull/5872#discus

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread liach
On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > moving nr declaration

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Roger Riggs
On Wed, 13 Apr 2022 15:03:22 GMT, Alan Bateman wrote: >> This change may be problematic for servers with a large number connections >> and an input stream for each connection. It could add up to 2k to the >> footprint of each connection when skip is used. > >> @AlanBateman You are correct abou

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 15:03:22 GMT, Alan Bateman wrote: > > @AlanBateman You are correct about this. But I wonder if this be a problem, > > why Reader class can afford store a skip buffer for each Reader. > > Is there anything different in the situations about skipBuffer in Reader > > and InputSt

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Roger Riggs
On Wed, 13 Apr 2022 14:52:20 GMT, XenoAmess wrote: >> It indeed is reallocated when the existing one is not large enough. > >> I recommend moving `nr` declaration from the beginning of the method to >> where it's actually used (here) > > @liach done. Sorry, I misunderstood your earlier comment

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Alan Bateman
On Wed, 13 Apr 2022 14:36:17 GMT, Alan Bateman wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add MIN_SKIP_BUFFER_SIZE > > This change may be problematic for servers with a large number connections > and an input s

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 14:51:34 GMT, liach wrote: >> The check for `skipBuffer.length < size` makes it appear that the buffer can >> be re-allocated. >> If it is allocated once then only the `skipBuffer == null` is needed. >> >> The code may be simpler if the 'size' variable is removed. >> >>

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread liach
On Wed, 13 Apr 2022 14:45:31 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/io/InputStream.java line 557: >> >>> 555: >>> 556: while (remaining > 0) { >>> 557: nr = read(skipBuffer, 0, (int)Math.min(size, remaining)); >> >> I recommend moving `nr` declaration f

Re: RFR: 8284638: store skip buffers in InputStream Object [v3]

2022-04-13 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: moving nr declaration from the beginning of the method to where it's actually used

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Roger Riggs
On Tue, 12 Apr 2022 23:13:26 GMT, liach wrote: >> XenoAmess has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add MIN_SKIP_BUFFER_SIZE > > src/java.base/share/classes/java/io/InputStream.java line 557: > >> 555: >> 556: while (re

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread XenoAmess
On Wed, 13 Apr 2022 14:36:17 GMT, Alan Bateman wrote: > This change may be problematic for servers with a large number connections > and an input stream for each connection. It could add up to 2k to the > footprint of each connection when skip is used. @AlanBateman You are correct about this.

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-13 Thread Alan Bateman
On Tue, 12 Apr 2022 22:19:18 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > add MIN_SKIP_BUFFER_S

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-12 Thread liach
On Tue, 12 Apr 2022 22:15:22 GMT, XenoAmess wrote: > What subclasses of InputStream in the JDK do not override skip(n)? >From a peek, the majority of subclasses do not override `skip(long)`. Most >overrides are delegations or optimizations for random access structures; but >there are some that

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-12 Thread liach
On Tue, 12 Apr 2022 22:19:18 GMT, XenoAmess wrote: >> @jmehrens what about this then? >> I think it safe now(actually this mechanism is learned from Reader) > > XenoAmess has updated the pull request incrementally with one additional > commit since the last revision: > > add MIN_SKIP_BUFFER_S

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-12 Thread XenoAmess
On Tue, 12 Apr 2022 20:39:52 GMT, Roger Riggs 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

Re: RFR: 8284638: store skip buffers in InputStream Object [v2]

2022-04-12 Thread XenoAmess
> @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) XenoAmess has updated the pull request incrementally with one additional commit since the last revision: add MIN_SKIP_BUFFER_SIZE - Changes: - all: https://git.openjdk.java.n

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-12 Thread Roger Riggs
On Tue, 12 Apr 2022 18:00:18 GMT, XenoAmess wrote: >> Is this change proposed as the result of some experience with particular >> apps and streams or just observation of the implementation? >> >> Is there any information about what kind of underlying streams do not >> support skip directly >>

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-12 Thread XenoAmess
On Mon, 11 Apr 2022 22:58:19 GMT, Roger Riggs wrote: > Is this change proposed as the result of some experience with particular apps > and streams or just observation of the implementation? just observation of the implementation of InputStream class and Reader class, and somehow wonder why the

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread Roger Riggs
On Mon, 11 Apr 2022 22:40:31 GMT, liach wrote: >> Isn't it the case that the length of the global `skipBuffer` is >> non-decreasing? Thus skipping 6 bytes after skipping 10 will not result in a >> new buffer allocation. >> >> Even so, it does appear that prior buffer allocations could be "lost

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread liach
On Mon, 11 Apr 2022 22:31:01 GMT, Brian Burkhalter wrote: > Even so, it does appear that prior buffer allocations could be "lost" due to > concurrent use of skip resulting in a "minor" memory leak in the heap. The minor leak, though maybe somewhat wasteful, is the necessary cost for thread saf

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread Brian Burkhalter
On Sat, 9 Oct 2021 19:02:17 GMT, XenoAmess wrote: >>> in extream situation, when doing this.skipBuffer = skipBuffer in Thread B, >>> it might make this.skipBuffer to a byte[6] in thread A, and thus cause a >>> IndexOutofBoundException in Thread A. >> >> No, it won't. The later `skipBuffer` ref

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread XenoAmess
On Sat, 9 Oct 2021 18:10:34 GMT, liach wrote: > > in extream situation, when doing this.skipBuffer = skipBuffer in Thread B, > > it might make this.skipBuffer to a byte[6] in thread A, and thus cause a > > IndexOutofBoundException in Thread A. > > No, it won't. The later `skipBuffer` reference

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread liach
On Sat, 9 Oct 2021 17:08:50 GMT, XenoAmess wrote: > in extream situation, when doing this.skipBuffer = skipBuffer in Thread B, it > might make this.skipBuffer to a byte[6] in thread A, and thus cause a > IndexOutofBoundException in Thread A. No, it won't. The later `skipBuffer` references are

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread XenoAmess
On Sat, 9 Oct 2021 17:01:16 GMT, XenoAmess wrote: >> You should really post your changes to jdk-dev at openjdk.java.net before >> submitting these so you can know if a change is potentially good or bad. >> Since jdk pull requests require issue numbers, you can ask people on the >> list if this

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread XenoAmess
On Sat, 9 Oct 2021 15:49:01 GMT, liach wrote: > You should really post your changes to jdk-dev at openjdk.java.net before > submitting these so you can know if a change is potentially good or bad. > Since jdk pull requests require issue numbers, you can ask people on the list > if this is a go

Re: RFR: 8284638: store skip buffers in InputStream Object

2022-04-11 Thread liach
On Fri, 8 Oct 2021 21:19:36 GMT, XenoAmess wrote: > @jmehrens what about this then? > I think it safe now(actually this mechanism is learned from Reader) You should really post your changes to jdk-dev at openjdk.java.net before submitting these so you can know if a change is potentially good or