Re: RFR: 6356745: (coll) Add PriorityQueue(Collection, Comparator) [v6]

2023-12-30 Thread Chen Liang
On Thu, 28 Dec 2023 00:09:09 GMT, Valeh Hajiyev wrote: >> This commit addresses the current limitation in the `PriorityQueue` >> implementation, which lacks a constructor to efficiently create a priority >> queue with a custom comparator and an existing collection. In order to >> create such a

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v15]

2023-12-30 Thread Markus KARG
On Sun, 17 Dec 2023 09:06:58 GMT, Alan Bateman wrote: >> Sergey Tsypanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8320971: Revert irrelevant changes > > For the method description, I think you can expand it to: > > - does not ret

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Sergey Tsypanov
On Sat, 30 Dec 2023 17:52:41 GMT, Markus KARG wrote: >> `com.sun.management.ThreadMXBean#getCurrentThreadAllocatedBytes` is >> reliable, isn't it? > > According to its JavaDocs it only returns *an approximation*, whatever that > means. And it is measuring memory, while I already explained that

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Markus KARG
On Sat, 30 Dec 2023 17:43:25 GMT, Vladimir Sitnikov wrote: >> I assume you mean "to make it a blackbox"? Actually I do not see how we >> could do that *reliably*, as I already wrote recently. > > `com.sun.management.ThreadMXBean#getCurrentThreadAllocatedBytes` is reliable, > isn't it? Accordi

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Vladimir Sitnikov
On Sat, 30 Dec 2023 17:37:25 GMT, Markus KARG wrote: >> Done. Can we somehow modify the test to make it white-box one? Maybe it's >> possible to measure memory allocation before and after method invocation in >> the way that we could use the difference as a proof of non-allocating >> invocatio

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Markus KARG
On Sat, 30 Dec 2023 16:44:14 GMT, Sergey Tsypanov wrote: >> src/java.base/share/classes/java/io/BufferedInputStream.java line 672: >> >>> 670: * does not modify the contents of the {@code byte[]} >>> 671: * {@code OutputStream.write(byte[], int, int)} write does not >>> read the conte

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Sergey Tsypanov
On Sat, 30 Dec 2023 12:05:22 GMT, Alan Bateman wrote: >> Sergey Tsypanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8320971: Fix test > > src/java.base/share/classes/java/io/BufferedInputStream.java line 672: > >> 670: * does

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v19]

2023-12-30 Thread Sergey Tsypanov
> It looks like we can skip copying of `byte[]` in > `BufferedInputStream.implTransferTo()` for `OutputStreams` residing in > `java.io`. > > See comment by @vlsi in > https://github.com/openjdk/jdk/pull/10525/files#diff-e19c508d1bb6ee78697ecca66947c395adda0d9c49a85bf696e677ecbd977af1R612 Serge

Re: RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v18]

2023-12-30 Thread Alan Bateman
On Thu, 28 Dec 2023 15:09:09 GMT, Sergey Tsypanov wrote: >> It looks like we can skip copying of `byte[]` in >> `BufferedInputStream.implTransferTo()` for `OutputStreams` residing in >> `java.io`. >> >> See comment by @vlsi in >> https://github.com/openjdk/jdk/pull/10525/files#diff-e19c508d1b