Re: Different costs of accessing volatile reference and array

2023-08-16 Thread Сергей Цыпанов
?On 2023-08-16 13:37, Сергей Цыпанов wrote: Hello,  I was measuring costs of hoisting volatile access out of the loop and found out, that there's a difference in numbers for arrays and "plain" references.  Here's the benchmark for array:  @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit

Re: Different costs of accessing volatile reference and array

2023-08-16 Thread Сергей Цыпанов
decreases from 98 to 7 ns. > If I read the data correctly, for the count=100 case in jdk 20 it takes > 109 ns/op for the array and 74 ns/op for the field. > > To me this looks like a field access is _less_ expensive. > > Am I missing something? > > On 2023-08-16 13:37,

Different costs of accessing volatile reference and array

2023-08-16 Thread Сергей Цыпанов
Hello, I was measuring costs of hoisting volatile access out of the loop and found out, that there's a difference in numbers for arrays and "plain" references. Here's the benchmark for array: @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(time = 2, iterations =

Classes used in method body are loaded lazily or eagerly depending on method return type

2023-05-23 Thread Сергей Цыпанов
Hello, originally this question was asked here: https://stackoverflow.com/q/76260269/12473843, the code sample for reproduction will be put below or can be found via the link The issue is about eager/lazy loading of a class depending on method return type. If one runs the code below with Java

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v4]

2022-11-09 Thread Сергей Цыпанов
On Mon, 17 Oct 2022 10:19:26 GMT, Сергей Цыпанов wrote: >> We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance >> is constructed without comparator. This allows to squash two branches in >> `TreeMap.get()` into one. >> >

Re: RFR: 8295670: Remove duplication in java/util/Formatter/Basic*.java

2022-10-29 Thread Сергей Цыпанов
On Fri, 28 Oct 2022 21:51:03 GMT, Justin Lu wrote: > Issue: Duplication of methods between Basic*.java test classes, due to auto > generation by genBasic.sh > > Fix: Reorganize parts of Basic-X.java.template into base class in Basic.java. > Toggled -nel flag for generation script

Re: RFR: 8295670: Remove duplication in java/util/Formatter/Basic*.java

2022-10-29 Thread Сергей Цыпанов
On Fri, 28 Oct 2022 21:51:03 GMT, Justin Lu wrote: > Issue: Duplication of methods between Basic*.java test classes, due to auto > generation by genBasic.sh > > Fix: Reorganize parts of Basic-X.java.template into base class in Basic.java. > Toggled -nel flag for generation script

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v6]

2022-10-26 Thread Сергей Цыпанов
nchmark.readLong 1 avgt 10 201,726 ± > 8,885 us/op > RandomAccessFileReadBenchmark.readLong 5 avgt 10 667,117 ± > 6,779 us/op > RandomAccessFileReadBenchmark.readShort1 avgt 10 560,259 ± > 16,783 us/op > RandomAccessFileRead

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v4]

2022-10-21 Thread Сергей Цыпанов
On Mon, 17 Oct 2022 19:42:14 GMT, liach wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8293630: Inline natural() > > src/java.base/share/classes/java/util/Tree

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v4]

2022-10-17 Thread Сергей Цыпанов
uld we also change it? Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8293630: Inline natural() - Changes: - all: https://git.openjdk.org/jdk/pull/9901/files - new: https://git.openjdk.org/jdk/pull/9901/files/a55957e9.

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v3]

2022-10-17 Thread Сергей Цыпанов
On Sun, 16 Oct 2022 19:43:54 GMT, Tagir F. Valeev wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Update src/java.base/share/classes/java/util/TreeMap.java >> >> Co-

Integrated: 8292698: Improve performance of DataInputStream

2022-10-16 Thread Сергей Цыпанов
On Sun, 21 Aug 2022 06:29:43 GMT, Сергей Цыпанов wrote: > I found out that reading from `DataInputStream` wrapping > `ByteArrayInputStream` (as well as `BufferedInputStream` or any `InputStream` > relying on `byte[]`) can be significantly improved by accessing volatile `in` > fie

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v3]

2022-10-14 Thread Сергей Цыпанов
uld we also change it? Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/java/util/TreeMap.java Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com> - Changes: - all:

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v2]

2022-10-14 Thread Сергей Цыпанов
On Thu, 13 Oct 2022 21:46:15 GMT, ExE Boss wrote: >> Nope, there'd be a compilation error > > It'll work fine if an unchecked cast is used: > Suggestion: > > @SuppressWarnings("unchecked") > Comparator> entryComparator = treeComparator == > null ? >

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder() [v2]

2022-10-14 Thread Сергей Цыпанов
uld we also change it? Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/java/util/TreeMap.java Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com> - Changes: - all:

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder()

2022-10-13 Thread Сергей Цыпанов
On Wed, 17 Aug 2022 11:23:57 GMT, Сергей Цыпанов wrote: > We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance is > constructed without comparator. This allows to squash two branches in > `TreeMap.get()` into one. > > P.S. I th

Re: RFR: 8292698: Improve performance of DataInputStream [v4]

2022-10-05 Thread Сергей Цыпанов
On Mon, 29 Aug 2022 08:46:20 GMT, Сергей Цыпанов wrote: >> I found out that reading from `DataInputStream` wrapping >> `ByteArrayInputStream` (as well as `BufferedInputStream` or any >> `InputStream` relying on `byte[]`) can be significantly improved by >> accessing

Re: RFR: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-04 Thread Сергей Цыпанов
On Sun, 2 Oct 2022 20:45:02 GMT, Сергей Цыпанов wrote: > `checkedExceptions` param of `MethodAccessorGenerator.generateMethod()` is > unused and should be removed in order to prevent allocations from > `Method.getExceptionTypes()` Is it going to be covered with new reflection

Re: RFR: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-04 Thread Сергей Цыпанов
On Tue, 4 Oct 2022 11:55:02 GMT, Claes Redestad wrote: >> @mlchung I can put here a stack trace of the application invoking the code >> if you are interested > > @stsypanov would be helpful to understand when this code still gets executed. > Also note that JEP 416 was integrated in JDK 18 so

Re: RFR: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-04 Thread Сергей Цыпанов
On Mon, 3 Oct 2022 16:44:56 GMT, Mandy Chung wrote: >> I agree that getting rid of the clone can help -- but since [JEP >> 416](https://openjdk.org/jeps/416) the generators modified here is mostly a >> fallback and the bulk of the use will use `MethodHandles` (unless you >> disable JEP 416

Integrated: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-03 Thread Сергей Цыпанов
On Sun, 2 Oct 2022 20:45:02 GMT, Сергей Цыпанов wrote: > `checkedExceptions` param of `MethodAccessorGenerator.generateMethod()` is > unused and should be removed in order to prevent allocations from > `Method.getExceptionTypes()` This pull request has now been integrated.

Re: RFR: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-03 Thread Сергей Цыпанов
On Sun, 2 Oct 2022 22:16:46 GMT, Claes Redestad wrote: >> `checkedExceptions` param of `MethodAccessorGenerator.generateMethod()` is >> unused and should be removed in order to prevent allocations from >> `Method.getExceptionTypes()` > > Seems reasonable, although these generators should only

RFR: 8294698: Remove unused 'checkedExceptions' param from MethodAccessorGenerator.generateMethod()

2022-10-02 Thread Сергей Цыпанов
`checkedExceptions` param of `MethodAccessorGenerator.generateMethod()` is unused and should be removed in order to prevent allocations from `Method.getExceptionTypes()` - Commit messages: - 8294698: Remove unused 'checkedExceptions' param from

Re: RFR: 8294397: Replace StringBuffer with StringBuilder within java.text [v3]

2022-09-30 Thread Сергей Цыпанов
On Thu, 29 Sep 2022 22:29:43 GMT, Brent Christian wrote: >> Justin Lu has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Tweak indentation in PaternEntry > > src/java.base/share/classes/java/text/PatternEntry.java line 291: > >> 289:

Re: RFR: 8294397: Replace StringBuffer with StringBuilder within java.text [v3]

2022-09-30 Thread Сергей Цыпанов
On Thu, 29 Sep 2022 22:29:43 GMT, Brent Christian wrote: >> Justin Lu has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Tweak indentation in PaternEntry > > src/java.base/share/classes/java/text/PatternEntry.java line 291: > >> 289:

Re: RFR: 8294626: Improve URL protocol lower casing [v3]

2022-09-30 Thread Сергей Цыпанов
On Fri, 30 Sep 2022 11:46:39 GMT, Claes Redestad wrote: >> Move a simple utility method from `URL` to the shared `sun.net.util.URLUtil` >> class, rename it for clarity and enhance it so that it returns the string >> literal if the protocol matches one of the tested variants. This helps >>

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v5]

2022-09-27 Thread Сергей Цыпанов
On Fri, 26 Aug 2022 20:59:57 GMT, Сергей Цыпанов wrote: >> Currently some operations of RandomAccessFile are implemented with multiple >> read() invocations: >> >> public final int readInt() throws IOException { >> int ch1 = this.read(); >> i

Re: RFR: 8292698: Improve performance of DataInputStream [v4]

2022-09-16 Thread Сергей Цыпанов
On Mon, 29 Aug 2022 08:46:20 GMT, Сергей Цыпанов wrote: >> I found out that reading from `DataInputStream` wrapping >> `ByteArrayInputStream` (as well as `BufferedInputStream` or any >> `InputStream` relying on `byte[]`) can be significantly improved by >> accessing

Re: RFR: 8292698: Improve performance of DataInputStream [v3]

2022-09-14 Thread Сергей Цыпанов
On Tue, 13 Sep 2022 20:04:08 GMT, Bernd wrote: > Does that mean there is no explicit test for DataInputStream endianess @ecki I think this is not strictly necessary as order of bytes is explicitly specified in JavaDoc of `DataInput` implemented by `DataInputStream` - PR:

Re: RFR: 8292698: Improve performance of DataInputStream [v3]

2022-09-13 Thread Сергей Цыпанов
On Thu, 25 Aug 2022 09:25:55 GMT, Alan Bateman wrote: >> Btw, I've tried to reimplement `readInt()` in a way similar to `readLong()`: >> >> public final int readInt() throws IOException { >> readFully(readBuffer, 0, 4); >> return (readBuffer[0] & 0xff) << 24 >> + (readBuffer[1]

Re: RFR: 8293647: Avoid unnecessary boxing in jdk.hotspot.agent

2022-09-13 Thread Сергей Цыпанов
On Mon, 12 Sep 2022 12:35:30 GMT, Andrey Turbanov wrote: > Usages of methods `Integer.valueOf`, `Boolean.valueOf`, `Long.valueOf` often > can be simplified by using their pair methods > `parseInt`/`parseBoolean`/`parseLong`. Marked as reviewed by stsypa...@github.com (no known OpenJDK

Integrated: 8287908: Use non-cloning reflection methods where acceptable

2022-09-12 Thread Сергей Цыпанов
On Tue, 7 Jun 2022 13:45:06 GMT, Сергей Цыпанов wrote: > Instead of `Executable.getParameterTypes()` we could use > `Executable.getSharedParameterTypes()` in trusted code. Same is applicable > for `Executable.getExceptionTypes()`. This pull request has now been integrated.

Re: RFR: 8292698: Improve performance of DataInputStream [v3]

2022-09-12 Thread Сергей Цыпанов
On Thu, 25 Aug 2022 09:25:55 GMT, Alan Bateman wrote: >> Btw, I've tried to reimplement `readInt()` in a way similar to `readLong()`: >> >> public final int readInt() throws IOException { >> readFully(readBuffer, 0, 4); >> return (readBuffer[0] & 0xff) << 24 >> + (readBuffer[1]

Re: RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder()

2022-09-12 Thread Сергей Цыпанов
On Sat, 20 Aug 2022 16:37:29 GMT, liach wrote: >> We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance >> is constructed without comparator. This allows to squash two branches in >> `TreeMap.get()` into one. >> >> P.S. I think the comment of

RFR: 8293630: Simplify TreeMap.get() with Comparator.naturalOrder()

2022-09-12 Thread Сергей Цыпанов
We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance is constructed without comparator. This allows to squash two branches in `TreeMap.get()` into one. P.S. I think the comment of `TreeMap.getEntryUsingComparator()` is outdated. Should we also change it? -

Re: RFR: 8287908: Use non-cloning reflection methods where acceptable [v2]

2022-09-08 Thread Сергей Цыпанов
On Wed, 7 Sep 2022 19:33:41 GMT, Roger Riggs wrote: >> You can probably appreciate how hard it is to keep track of what's a copy >> (and needs to be copied) and what's not through several levels of APIs. From >> a security perspective, its better to spend a little extra at runtime, than >> to

Re: RFR: 8287908: Use non-cloning reflection methods where acceptable [v3]

2022-09-07 Thread Сергей Цыпанов
On Tue, 14 Jun 2022 19:36:51 GMT, Сергей Цыпанов wrote: >> Instead of `Executable.getParameterTypes()` we could use >> `Executable.getSharedParameterTypes()` in trusted code. Same is applicable >> for `Executable.getExceptionTypes()`. > > Сергей Цыпанов has

Re: RFR: 8279283 - BufferedInputStream should override transferTo [v9]

2022-09-07 Thread Сергей Цыпанов
On Tue, 6 Sep 2022 17:20:22 GMT, Markus KARG wrote: >> Implementation of JDK-8279283 > > Markus KARG has updated the pull request incrementally with one additional > commit since the last revision: > > Revert "HexPrinter::transferTo" > > This reverts commit

Re: RFR: 8279283 - BufferedInputStream should override transferTo [v8]

2022-09-06 Thread Сергей Цыпанов
On Tue, 6 Sep 2022 12:50:50 GMT, Markus KARG wrote: >> Implementation of JDK-8279283 > > Markus KARG has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains ten commits: > > - proposal by Alan Bateman > - modified locking > -

Re: RFR: 8279283 - BufferedInputStream should override transferTo [v5]

2022-09-02 Thread Сергей Цыпанов
On Mon, 27 Dec 2021 13:43:12 GMT, Markus KARG wrote: >> Implementation of JDK-8279283 > > Markus KARG has updated the pull request incrementally with one additional > commit since the last revision: > > fixed missing BufferedInputStream Will this be reopened somewhen? The proposed changes

Re: RFR: 8293017: Improve hash calculation parallelism in jmod/jlink

2022-08-29 Thread Сергей Цыпанов
On Mon, 29 Aug 2022 08:55:06 GMT, Aleksey Shipilev wrote: > `jmod`/`jlink` are executed during build time to produce the `jmod` and the > base modules image. On slow hardware (Raspberry Pi -class, for example) > and/or slow VMs (debug, interpreter-only, for example) this takes a while. >

Re: RFR: 8292698: Improve performance of DataInputStream [v4]

2022-08-29 Thread Сергей Цыпанов
avgt 20 21,804 ± 0,197 us/op > > patch: > > Benchmark Mode Cnt Score Error Units > DataInputStreamTest.readChar avgt 20 11,018 ± 0,089 us/op > DataInputStreamTest.readInt avgt 20 5,608 ± 0,087 us/op Сергей Цыпанов has updated the pull request with a new targ

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v5]

2022-08-29 Thread Сергей Цыпанов
On Sat, 27 Aug 2022 06:52:19 GMT, Alan Bateman wrote: >> Сергей Цыпанов has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - 8292937: Fix error C2057 >> - 8292937: Remove unused method > > src/java.base

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v5]

2022-08-26 Thread Сергей Цыпанов
nchmark.readLong 1 avgt 10 201,726 ± > 8,885 us/op > RandomAccessFileReadBenchmark.readLong 5 avgt 10 667,117 ± > 6,779 us/op > RandomAccessFileReadBenchmark.readShort1 avgt 10 560,259 ± > 16,783 us/op > RandomAccessFileReadB

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v4]

2022-08-26 Thread Сергей Цыпанов
nchmark.readLong 1 avgt 10 201,726 ± > 8,885 us/op > RandomAccessFileReadBenchmark.readLong 5 avgt 10 667,117 ± > 6,779 us/op > RandomAccessFileReadBenchmark.readShort1 avgt 10 560,259 ± > 16,783 us/op > RandomAccessFileRead

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v2]

2022-08-26 Thread Сергей Цыпанов
On Fri, 26 Aug 2022 16:39:01 GMT, Brian Burkhalter wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8292937: Move logic into VM side > > src/java.base/share/native/libja

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v3]

2022-08-26 Thread Сергей Цыпанов
nchmark.readLong 1 avgt 10 201,726 ± > 8,885 us/op > RandomAccessFileReadBenchmark.readLong 5 avgt 10 667,117 ± > 6,779 us/op > RandomAccessFileReadBenchmark.readShort1 avgt 10 560,259 ± > 16,783 us/op > RandomAccessFileReadB

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v2]

2022-08-26 Thread Сергей Цыпанов
On Fri, 26 Aug 2022 12:56:50 GMT, Alan Bateman wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8292937: Move logic into VM side > > src/java.base/share/native/libjava/io_util.c lin

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile

2022-08-26 Thread Сергей Цыпанов
On Fri, 26 Aug 2022 01:49:06 GMT, Quan Anh Mai wrote: >>> Maybe you can modify the read0 method to receive a width parameter >>> additionally. >> >> @merykitty sorry, I don't get it. We already have `readBytes0()` returning >> array. Why do we need to add a new param to `read0`? > >

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile [v2]

2022-08-26 Thread Сергей Цыпанов
nchmark.readLong 1 avgt 10 201,726 ± > 8,885 us/op > RandomAccessFileReadBenchmark.readLong 5 avgt 10 667,117 ± > 6,779 us/op > RandomAccessFileReadBenchmark.readShort1 avgt 10 560,259 ± > 16,783 us/op > RandomAccessFileRead

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile

2022-08-26 Thread Сергей Цыпанов
On Thu, 25 Aug 2022 17:14:20 GMT, Сергей Цыпанов wrote: > Currently some operations of RandomAccessFile are implemented with multiple > read() invocations: > > public final int readInt() throws IOException { > int ch1 = this.read(); > int ch2 = this.read(); >

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile

2022-08-25 Thread Сергей Цыпанов
On Thu, 25 Aug 2022 17:58:05 GMT, Quan Anh Mai wrote: > Maybe you can modify the read0 method to receive a width parameter > additionally. @merykitty sorry, I don't get it. We already have `readBytes0()` returning array. Why do we need to add a new param to `read0`? - PR:

Re: RFR: 8292937: Improve performance of some read operations of RandomAccessFile

2022-08-25 Thread Сергей Цыпанов
On Thu, 25 Aug 2022 17:31:05 GMT, Brian Burkhalter wrote: >> Currently some operations of RandomAccessFile are implemented with multiple >> read() invocations: >> >> public final int readInt() throws IOException { >> int ch1 = this.read(); >> int ch2 = this.read(); >> int ch3 =

RFR: 8292937: Improve performance of some read operations of RandomAccessFile

2022-08-25 Thread Сергей Цыпанов
Currently some operations of RandomAccessFile are implemented with multiple read() invocations: public final int readInt() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0)

Re: RFR: 8292698: Improve performance of DataInputStream [v3]

2022-08-25 Thread Сергей Цыпанов
On Sun, 21 Aug 2022 20:07:10 GMT, Сергей Цыпанов wrote: >> I found out that reading from `DataInputStream` wrapping >> `ByteArrayInputStream` (as well as `BufferedInputStream` or any >> `InputStream` relying on `byte[]`) can be significantly improved by >> accessing

Re: RFR: 8292698: Improve performance of DataInputStream

2022-08-23 Thread Сергей Цыпанов
On Tue, 23 Aug 2022 17:12:50 GMT, Alan Bateman wrote: > The main thing is to think through the implications for async close where the > close method replaces 'in'. Suppose we have a scenario where `in` is replaced asynchronously in one of implementations and the implementation is passed into

Re: RFR: 8292698: Improve performance of DataInputStream

2022-08-23 Thread Сергей Цыпанов
On Tue, 23 Aug 2022 13:57:35 GMT, Daniel Fuchs wrote: > I agree that caution is warranted But assuming I've reverted the changes that are dubious, how could there be bugs caused by replacement of multiple reads with a single one? I was sure that such replacement improves thread safety as soon

Re: RFR: 8292698: Improve performance of DataInputStream [v3]

2022-08-21 Thread Сергей Цыпанов
avgt 20 21,804 ± 0,197 us/op > > patch: > > Benchmark Mode Cnt Score Error Units > DataInputStreamTest.readChar avgt 20 11,018 ± 0,089 us/op > DataInputStreamTest.readInt avgt 20 5,608 ± 0,087 us/op Сергей Цыпанов has updated the pull request incre

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Thanks! ---

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Thanks! ---

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Thanks! ---

Integrated: 8290300: Use standard String-joining tools where applicable

2022-08-21 Thread Сергей Цыпанов
On Fri, 15 Jul 2022 12:03:13 GMT, Сергей Цыпанов wrote: > Simplify code with `String.join()` This pull request has now been integrated. Changeset: 9a65524e Author:Sergey Tsypanov Committer: Claes Redestad URL: https://git.openjdk.org/jdk/com

Integrated: 8290300: Use standard String-joining tools where applicable

2022-08-21 Thread Сергей Цыпанов
On Fri, 15 Jul 2022 12:03:13 GMT, Сергей Цыпанов wrote: > Simplify code with `String.join()` This pull request has now been integrated. Changeset: 9a65524e Author:Sergey Tsypanov Committer: Claes Redestad URL: https://git.openjdk.org/jdk/com

Integrated: 8290300: Use standard String-joining tools where applicable

2022-08-21 Thread Сергей Цыпанов
On Fri, 15 Jul 2022 12:03:13 GMT, Сергей Цыпанов wrote: > Simplify code with `String.join()` This pull request has now been integrated. Changeset: 9a65524e Author:Sergey Tsypanov Committer: Claes Redestad URL: https://git.openjdk.org/jdk/com

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Anyone to sponso

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Anyone to sponso

Re: RFR: 8290300: Use standard String-joining tools where applicable [v5]

2022-08-21 Thread Сергей Цыпанов
On Mon, 18 Jul 2022 18:40:51 GMT, Сергей Цыпанов wrote: >> Simplify code with `String.join()` > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8290300: Revert erroneous changes Anyone to sponso

Re: RFR: 8292698: Improve performance of DataInputStream [v2]

2022-08-21 Thread Сергей Цыпанов
avgt 20 21,804 ± 0,197 us/op > > patch: > > Benchmark Mode Cnt Score Error Units > DataInputStreamTest.readChar avgt 20 11,018 ± 0,089 us/op > DataInputStreamTest.readInt avgt 20 5,608 ± 0,087 us/op Сергей Цыпанов has updated the pull request increment

Re: RFR: 8292698: Improve performance of DataInputStream

2022-08-21 Thread Сергей Цыпанов
On Sun, 21 Aug 2022 06:29:43 GMT, Сергей Цыпанов wrote: > I found out that reading from `DataInputStream` wrapping > `ByteArrayInputStream` (as well as `BufferedInputStream` or any `InputStream` > relying on `byte[]`) can be significantly improved by accessing volatile `in` > fie

RFR: 8292698: Improve performance of DataInputStream

2022-08-21 Thread Сергей Цыпанов
I found out that reading from `DataInputStream` wrapping `ByteArrayInputStream` (as well as `BufferedInputStream` or any `InputStream` relying on `byte[]`) can be significantly improved by accessing volatile `in` field only once per operation. Current implementation does it for each call of

Re: RFR: 8292280: Unused field 'keyListener' in BasicRadioButtonUI

2022-08-17 Thread Сергей Цыпанов
On Thu, 11 Aug 2022 06:53:16 GMT, Andrey Turbanov wrote: > Field `keyListener` was added under > [JDK-8033699](https://bugs.openjdk.org/browse/JDK-8033699). But then all its > usages were removed in > [JDK-8249548](https://bugs.openjdk.org/browse/JDK-8249548) LGTM - Marked as

Re: RFR: 8287908: Use non-cloning reflection methods where acceptable [v3]

2022-08-10 Thread Сергей Цыпанов
On Tue, 14 Jun 2022 19:36:51 GMT, Сергей Цыпанов wrote: >> Instead of `Executable.getParameterTypes()` we could use >> `Executable.getSharedParameterTypes()` in trusted code. Same is applicable >> for `Executable.getExceptionTypes()`. > > Сергей Цыпанов has

Re: RFR: 8292026: Remove redundant allocations from DoubleByteEncoder

2022-08-08 Thread Сергей Цыпанов
On Fri, 5 Aug 2022 07:07:57 GMT, Andrey Turbanov wrote: > There are couple places where new byte array is allocated and then thrown > away. Marked as reviewed by stsypa...@github.com (no known OpenJDK username). - PR: https://git.openjdk.org/jdk/pull/9767

Re: RFR: 8292026: Remove redundant allocations from DoubleByteEncoder

2022-08-08 Thread Сергей Цыпанов
On Fri, 5 Aug 2022 07:07:57 GMT, Andrey Turbanov wrote: > There are couple places where new byte array is allocated and then thrown > away. Nice catch! - Marked as reviewed by stsypa...@github.com (no known OpenJDK username). PR: https://git.openjdk.org/jdk/pull/9767

Integrated: 8288327: Executable.hasRealParameterData should not be volatile

2022-08-04 Thread Сергей Цыпанов
On Mon, 13 Jun 2022 18:42:24 GMT, Сергей Цыпанов wrote: > If there are two threads calling `Executable.hasRealParameterData()` under > race and the first one writes into volatile `Executable.parameters` field > (doing _releasing store_) and the second thread reads non-null v

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v7]

2022-08-02 Thread Сергей Цыпанов
On Tue, 2 Aug 2022 17:48:07 GMT, Peter Levart wrote: >> Let's wait a bit > > @stsypanov Do you need a sponsor or are you waiting for some other reviewer? @plevart I don't think we need any more review for the change is simple - PR: https://git.openjdk.org/jdk/pull/9143

Re: RFR: 8288327: Executable.hasRealParameterData should not be volatile [v7]

2022-08-02 Thread Сергей Цыпанов
On Thu, 30 Jun 2022 12:08:19 GMT, Сергей Цыпанов wrote: >> If there are two threads calling `Executable.hasRealParameterData()` under >> race and the first one writes into volatile `Executable.parameters` field >> (doing _releasing store_) and the second thread reads n

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v2]

2022-08-01 Thread Сергей Цыпанов
On Mon, 1 Aug 2022 17:35:05 GMT, David Schlosnagle wrote: >> I would like to contribute an optimized version of >> `StackTraceElement#toString()` that uses a single StringBuilder throughout >> creation to avoid intermediate `String` allocations. >> `StackTraceElement#toString()` is used in a

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 13:45:53 GMT, David Schlosnagle wrote: >> I think in this case it's better to specify `StringBuilder` instead of >> `Appendable`, because the method is private and you'd hardly ever pass there >> anything different from SB. > > If we go with the proposal above to make

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 14:38:50 GMT, Carter Kozak wrote: >> `Throwable.printStackTrace()` will use `StringBuilder` as well, won't it? > > I don't think so, it appends directly do something like System.err (default) > or another PrintStream/PrintWriter without fully holding the string value on >

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 13:07:01 GMT, David Schlosnagle wrote: >> src/java.base/share/classes/java/lang/StackTraceElement.java line 400: >> >>> 398: dest.append(fileName) >>> 399: .append(':') >>> 400:

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread Сергей Цыпанов
On Wed, 27 Jul 2022 22:56:39 GMT, David Schlosnagle wrote: > I would like to contribute an optimized version of > `StackTraceElement#toString()` that uses a single StringBuilder throughout > creation to avoid intermediate `String` allocations. > `StackTraceElement#toString()` is used in a

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread Сергей Цыпанов
On Mon, 1 Aug 2022 16:20:25 GMT, David Schlosnagle wrote: >> If the objective of this patch is to optimise >> `StackTraceElement::toString()`, then I would suggest the most efficient >> method of calculating the length and encoding of the result, filling the >> backing buffer then using the

Redundant BufferedInputStream in FileURLConnection

2022-07-25 Thread Сергей Цыпанов
Hi, I've noticed that in most of the code outside of JDK an InputStream taken from FileURLConnection is either read entirely e.g.in ASM's ClassLoader or passed into Properties where it's read with LineReader (which itself has an internal buffer). Apart from mark/reset activity we need buffering

Withdrawn: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-25 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 15:37:40 GMT, Сергей Цыпанов wrote: > We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. This pull request has been closed without being integrated. - PR: https://git.openjdk.org/jdk/pull/9596

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops [v2]

2022-07-25 Thread Сергей Цыпанов
On Mon, 25 Jul 2022 06:40:49 GMT, Сергей Цыпанов wrote: >> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8278461: Reve

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops [v2]

2022-07-25 Thread Сергей Цыпанов
On Mon, 25 Jul 2022 06:40:49 GMT, Сергей Цыпанов wrote: >> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: > > 8278461: Reve

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops [v2]

2022-07-25 Thread Сергей Цыпанов
> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8278461: Revert X509CertPath - Changes: - all: https://git.openjdk.org/jdk/pull/9

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops [v2]

2022-07-25 Thread Сергей Цыпанов
> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8278461: Revert X509CertPath - Changes: - all: https://git.openjdk.org/jdk/pull/9

Re: RFR: 8289659: Refactor I/O stream copying to use InputStream.readAllBytes in X509CertPath

2022-07-23 Thread Сергей Цыпанов
On Thu, 23 Jun 2022 19:32:44 GMT, Andrey Turbanov wrote: > Use `InputStream.readAllBytes` instead of manually written method. > > Skipped this method in > [JDK-8080272](https://bugs.openjdk.org/browse/JDK-8080272) Marked as reviewed by stsypa...@github.com (no known OpenJDK username).

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-23 Thread Сергей Цыпанов
On Sat, 23 Jul 2022 18:10:15 GMT, Andrey Turbanov wrote: >> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. > > Ow. I've created similar PR for `X509CertPath` recently #9263 @turbanoff I'll then remove the mentioned piece from this PR - PR:

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-23 Thread Сергей Цыпанов
On Sat, 23 Jul 2022 18:10:15 GMT, Andrey Turbanov wrote: >> We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. > > Ow. I've created similar PR for `X509CertPath` recently #9263 @turbanoff I'll then remove the mentioned piece from this PR - PR:

Integrated: 8289572: InputStream wrapping with BufferedInputStream is redundant in HttpTimestamper

2022-07-22 Thread Сергей Цыпанов
On Fri, 1 Jul 2022 08:06:10 GMT, Сергей Цыпанов wrote: > In case we read all bytes from an `InputStream` we don't need wrapping with > `BufferedInputStream` as the bytes are not written into internal buffer. With > removal of redundant buffer we save 8 kB of allocated memory.

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-22 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 15:37:40 GMT, Сергей Цыпанов wrote: > We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. Could one advise how to execute smth like `jmod hash --module-path ~/openjdk-18.0.2/Contents/Home/jmods --hash-modules .*`? This command doesn't work for

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-22 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 15:37:40 GMT, Сергей Цыпанов wrote: > We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. Could one advise how to execute smth like `jmod hash --module-path ~/openjdk-18.0.2/Contents/Home/jmods --hash-modules .*`? This command doesn't work for

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-22 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 21:14:44 GMT, Mark Reinhold wrote: > Please revise the summary to say “... instead of explicit loops”. Done. > Please measure this (using, e.g., [JMH](https://github.com/openjdk/jmh)) > before making such a change. I'm aware of JMH, I was asking mostly about public API I

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of explicit loops

2022-07-22 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 21:14:44 GMT, Mark Reinhold wrote: > Please revise the summary to say “... instead of explicit loops”. Done. > Please measure this (using, e.g., [JMH](https://github.com/openjdk/jmh)) > before making such a change. I'm aware of JMH, I was asking mostly about public API I

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of surrogate code

2022-07-21 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 15:37:40 GMT, Сергей Цыпанов wrote: > We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. By "surrogate code" I mean hand-written snippets reading all the bytes from an InputStream. > It means the whole content from the inpu

Re: RFR: 8290824: Use InputStream.readAllBytes() instead of surrogate code

2022-07-21 Thread Сергей Цыпанов
On Thu, 21 Jul 2022 15:37:40 GMT, Сергей Цыпанов wrote: > We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. By "surrogate code" I mean hand-written snippets reading all the bytes from an InputStream. > It means the whole content from the inpu

RFR: 8290824: Use InputStream.readAllBytes() instead of surrogate code

2022-07-21 Thread Сергей Цыпанов
We can use `InputStream.readAllBytes()` in `ModuleHashes` and `X509CertPath`. - Commit messages: - 8290824: Remove unused JavaDoc - 8290824: Use InputStream.readAllBytes() instead of surrogate code Changes: https://git.openjdk.org/jdk/pull/9596/files Webrev:

  1   2   3   4   5   6   7   8   9   10   >