Integrated: 8282662: Use List.of() factory method to reduce memory consumption

2022-06-01 Thread Сергей Цыпанов
On Mon, 7 Mar 2022 15:11:50 GMT, Сергей Цыпанов wrote: > `List.of()` along with `Set.of()` create unmodifiable `List/Set` but with > smaller footprint comparing to `Arrays.asList()` / `new HashSet()` when > called with vararg of size 0, 1, 2. > > In general replacement of

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v9]

2022-06-01 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request incrementally with one additional commit since the

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v8]

2022-05-31 Thread Сергей Цыпанов
On Tue, 31 May 2022 19:33:15 GMT, Roger Riggs wrote: >> Сергей Цыпанов has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request conta

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v8]

2022-05-31 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. Th

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v7]

2022-05-31 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. Th

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v6]

2022-05-26 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. Th

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v5]

2022-05-18 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. Th

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v4]

2022-05-18 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request with a new target base due to a merge or a

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-05-18 Thread Сергей Цыпанов
On Mon, 16 May 2022 15:29:38 GMT, Сергей Цыпанов wrote: >> Even in the no exceptions case, the `exceptionTypes` array still has to be  >> allocated/copied by `Method.getExceptionTypes()`[^1] when the `ProxyMethod`  >> constructor[^2] is invoked. >> >> So if a

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-05-16 Thread Сергей Цыпанов
On Fri, 13 May 2022 13:36:52 GMT, ExE Boss wrote: > So if anything, the List.of(…) call should be moved into the ProxyMethod > constructor. And maybe the call to Method.getExceptionTypes() should be > changed to Method.getSharedExceptionTypes() Makes sense. Do you want me to do this within

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-05-13 Thread Сергей Цыпанов
On Fri, 13 May 2022 11:14:29 GMT, ExE Boss wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes in MethodType > > src/java.base/share/classes/java/lang/re

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-05-13 Thread Сергей Цыпанов
On Fri, 13 May 2022 12:19:08 GMT, Сергей Цыпанов wrote: >> src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 727: >> >>> 725: MethodVisitor mv = cw.visitMethod(accessFlags, >>> 726: method.

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-05-13 Thread Сергей Цыпанов
On Thu, 12 May 2022 14:14:38 GMT, Weijun Wang wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes in MethodType > > src/java.base/share/

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-04-26 Thread Сергей Цыпанов
On Thu, 10 Mar 2022 08:52:17 GMT, Сергей Цыпанов wrote: >> `List.of()` along with `Set.of()` create unmodifiable `List/Set` but with >> smaller footprint comparing to `Arrays.asList()` / `new HashSet()` when >> called with vararg of size 0, 1, 2. >> >> In general

Re: RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]

2022-03-29 Thread Сергей Цыпанов
On Sat, 26 Mar 2022 16:35:14 GMT, liach wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes in MethodType > > Just curious, this issue asks to replace

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v3]

2022-03-26 Thread Сергей Цыпанов
On Thu, 10 Mar 2022 08:52:17 GMT, Сергей Цыпанов wrote: >> `List.of()` along with `Set.of()` create unmodifiable `List/Set` but with >> smaller footprint comparing to `Arrays.asList()` / `new HashSet()` when >> called with vararg of size 0, 1, 2. >> >> In general

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v3]

2022-03-10 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request incrementally with one additional commit since the la

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v2]

2022-03-10 Thread Сергей Цыпанов
On Wed, 9 Mar 2022 16:09:01 GMT, liach wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes > > src/java.base/share/classes/java/lang/invoke/Metho

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v2]

2022-03-09 Thread Сергей Цыпанов
On Tue, 8 Mar 2022 14:27:23 GMT, liach wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes > > src/java.base/share/classes/java/nio/file/FileTreeI

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v2]

2022-03-09 Thread Сергей Цыпанов
On Tue, 8 Mar 2022 14:28:00 GMT, liach wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8282662: Revert dubious changes > > src/java.base/share/classes/sun/reflect/annotation/Ann

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption [v2]

2022-03-09 Thread Сергей Цыпанов
parameter types are never null > - interfaces used for proxy construction and returned from > `Class.getInterfaces()` are never null > - exceptions types of method signature are never null Сергей Цыпанов has updated the pull request incrementally with one additional commit since the la

Re: RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption

2022-03-08 Thread Сергей Цыпанов
On Mon, 7 Mar 2022 16:06:44 GMT, Claes Redestad wrote: > Notice list.of will have the downside of copying the input array when the > size is not small while arrays aslist does not. Is the tradeoff worth it? Good point, I see risky changes in this PR: - `ProxyGenerator` - `Proxy` - `MethodType`

RFR: 8282662: Use List/Set.of() factory methods to reduce memory consumption

2022-03-07 Thread Сергей Цыпанов
`List.of()` along with `Set.of()` create unmodifiable `List/Set` but with smaller footprint comparing to `Arrays.asList()` / `new HashSet()` when called with vararg of size 0, 1, 2. In general replacement of `Arrays.asList()` with `List.of()` is dubious as the latter is null-hostile, however

Re: RFR: 8282632: Cleanup unnecessary calls to Throwable.initCause() in java.security.jgss

2022-03-04 Thread Сергей Цыпанов
On Thu, 3 Mar 2022 19:33:21 GMT, Andrey Turbanov wrote: > Pass cause exception as constructor parameter is shorter and easier to read. LGTM - Marked as reviewed by stsypa...@github.com (no known OpenJDK username). PR: https://git.openjdk.java.net/jdk/pull/7682

Re: RFR: 8274811: Remove superfluous use of boxing in java.base

2021-12-27 Thread Сергей Цыпанов
On Sat, 27 Nov 2021 17:41:58 GMT, Andrey Turbanov wrote: >> Usages of primitive types should be preferred and makes code easier to read. >> Similar cleanups: >> 1. [JDK-8273168](https://bugs.openjdk.java.net/browse/JDK-8273168) >> java.desktop >> 2.

Re: RFR: 8274811: Remove superfluous use of boxing in java.base

2021-12-26 Thread Сергей Цыпанов
On Sat, 11 Sep 2021 12:11:50 GMT, Andrey Turbanov wrote: > Usages of primitive types should be preferred and makes code easier to read. > Similar cleanups: > 1. [JDK-8273168](https://bugs.openjdk.java.net/browse/JDK-8273168) > java.desktop > 2.

Integrated: 8268764: Use Long.hashCode() instead of int-cast where applicable

2021-10-12 Thread Сергей Цыпанов
On Tue, 15 Jun 2021 12:15:11 GMT, Сергей Цыпанов wrote: > In some JDK classes there's still the following hashCode() implementation: > > long objNum; > > public int hashCode() { > return (int) objNum; > } > > This outdated expression should be repla

Re: RFR: 8274811: Remove superfluous use of boxing in java.base

2021-10-06 Thread Сергей Цыпанов
On Sat, 11 Sep 2021 12:11:50 GMT, Andrey Turbanov wrote: > Usages of primitive types should be preferred and makes code easier to read. > Similar cleanups: > 1. [JDK-8273168](https://bugs.openjdk.java.net/browse/JDK-8273168) > java.desktop > 2.

Re: RFR: 8274308: Improve efficiency for HandshakeContext initialization.

2021-10-04 Thread Сергей Цыпанов
On Sat, 2 Oct 2021 05:45:47 GMT, Clive Verghese wrote: > Hi, > > We have identified that the `HandshakeContext` initialization takes up a > close to 50% of the flame graph for startHandshake. I have moved the > computation of the `activeProtocols` and `activeCipherSuites` from the >

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v4]

2021-09-16 Thread Сергей Цыпанов
On Thu, 1 Jul 2021 12:19:53 GMT, Сергей Цыпанов wrote: >> In some JDK classes there's still the following hashCode() implementation: >> >> long objNum; >> >> public int hashCode() { >> return (int) objNum; >> } >> >> This outdated

Re: RFR: 8273528: Avoid ByteArrayOutputStream.toByteArray when converting stream to String

2021-09-09 Thread Сергей Цыпанов
On Thu, 2 Sep 2021 20:19:40 GMT, Andrey Turbanov wrote: > Using `ByteArrayOutputStream.toString` to convert it's content to a String is > cleaner than `new String(out.toByteArray())`. Also it's a bit faster because > of one less array copy. Marked as reviewed by stsypa...@github.com (no

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v4]

2021-08-19 Thread Сергей Цыпанов
On Thu, 1 Jul 2021 12:19:53 GMT, Сергей Цыпанов wrote: >> In some JDK classes there's still the following hashCode() implementation: >> >> long objNum; >> >> public int hashCode() { >> return (int) objNum; >> } >> >> This outdated

Integrated: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

2021-08-12 Thread Сергей Цыпанов
On Tue, 10 Aug 2021 13:16:42 GMT, Сергей Цыпанов wrote: > The code in `Integer.decode()` and `Long.decode()` might allocate two > instances of Integer/Long for the negative values less than -127: > > Integer result; > > result = Integer.valueOf(nm.substring(index)

Re: RFR: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable [v2]

2021-08-10 Thread Сергей Цыпанов
.intValue()) : result; > > To avoid this we can declare 'result' as `int` and use `Integer.parseInt()` > method. Same applicable for `Long` and some other classes. Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes

Re: RFR: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

2021-08-10 Thread Сергей Цыпанов
On Tue, 10 Aug 2021 17:39:01 GMT, Сергей Цыпанов wrote: >> src/java.base/share/classes/java/lang/Integer.java line 1450: >> >>> 1448: >>> 1449: try { >>> 1450: result = parseInt(nm.substring(index), radix); >> >> Possibl

Re: RFR: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

2021-08-10 Thread Сергей Цыпанов
On Tue, 10 Aug 2021 14:56:11 GMT, Claes Redestad wrote: >> The code in `Integer.decode()` and `Long.decode()` might allocate two >> instances of Integer/Long for the negative values less than -127: >> >> Integer result; >> >> result = Integer.valueOf(nm.substring(index), radix); >> result =

RFR: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

2021-08-10 Thread Сергей Цыпанов
The code in `Integer.decode()` and `Long.decode()` might allocate two instances of Integer/Long for the negative values less than -127: Integer result; result = Integer.valueOf(nm.substring(index), radix); result = negative ? Integer.valueOf(-result.intValue()) : result; To avoid this we can

Re: RFR: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-07-26 Thread Сергей Цыпанов
On Mon, 14 Jun 2021 17:00:29 GMT, Andrey Turbanov wrote: > I found few places, where code initially perform `Object[] > Colleciton.toArray()` call and then manually copy array into another array > with required type. > This PR cleanups such places to more shorter call `T[] >

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v3]

2021-07-01 Thread Сергей Цыпанов
On Thu, 1 Jul 2021 10:38:24 GMT, Сергей Цыпанов wrote: >> In some JDK classes there's still the following hashCode() implementation: >> >> long objNum; >> >> public int hashCode() { >> return (int) objNum; >> } >> >> This outdated

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v4]

2021-07-01 Thread Сергей Цыпанов
ould be the case if the two halves were combined with an OR (AND) operation. > > See https://stackoverflow.com/a/4045083 > > This is related to https://github.com/openjdk/jdk/pull/4309 Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8268

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v3]

2021-07-01 Thread Сергей Цыпанов
ould be the case if the two halves were combined with an OR (AND) operation. > > See https://stackoverflow.com/a/4045083 > > This is related to https://github.com/openjdk/jdk/pull/4309 Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8268

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v2]

2021-07-01 Thread Сергей Цыпанов
On Wed, 30 Jun 2021 11:49:51 GMT, Сергей Цыпанов wrote: >> In some JDK classes there's still the following hashCode() implementation: >> >> long objNum; >> >> public int hashCode() { >> return (int) objNum; >> } >> >> This outdated

Re: RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable [v2]

2021-06-30 Thread Сергей Цыпанов
ould be the case if the two halves were combined with an OR (AND) operation. > > See https://stackoverflow.com/a/4045083 > > This is related to https://github.com/openjdk/jdk/pull/4309 Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental we

Re: RFR: 8268873: Unnecessary Vector usage in java.base

2021-06-22 Thread Сергей Цыпанов
On Mon, 14 Jun 2021 11:34:50 GMT, Andrey Turbanov wrote: > Usage of thread-safe collection `Vector` is unnecessary. It's recommended to > use `ArrayList` if a thread-safe implementation is not needed. > I checked only places where `Vector` was used as local variable. Marked as reviewed by

Re: RFR: 8268873: Unnecessary Vector usage in java.base

2021-06-17 Thread Сергей Цыпанов
On Wed, 16 Jun 2021 09:49:17 GMT, Andrey Turbanov wrote: >> src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java line >> 154: >> >>> 152: while (tokenizer.hasMoreTokens()) >>> 153: v.add(tokenizer.nextToken()); >>> 154: ciphers = new

Re: RFR: 8268873: Unnecessary Vector usage in java.base

2021-06-16 Thread Сергей Цыпанов
On Mon, 14 Jun 2021 11:34:50 GMT, Andrey Turbanov wrote: > Usage of thread-safe collection `Vector` is unnecessary. It's recommended to > use `ArrayList` if a thread-safe implementation is not needed. > I checked only places where `Vector` was used as local variable. I've filed

RFR: 8268764: Use Long.hashCode() instead of int-cast where applicable

2021-06-15 Thread Сергей Цыпанов
In some JDK classes there's still the following hashCode() implementation: long objNum; public int hashCode() { return (int) objNum; } This outdated expression should be replaced with Long.hashCode(long) as it - uses all bits of the original value, does not discard any information

Integrated: 8261880: Change nested classes in java.base to static nested classes where possible

2021-05-20 Thread Сергей Цыпанов
On Tue, 16 Feb 2021 14:30:58 GMT, Сергей Цыпанов wrote: > Non-static classes hold a link to their parent classes, which in many cases > can be avoided. This pull request has now been integrated. Changeset: 9425d3de Author:Sergey Tsypanov Committer: Claes Redestad URL:

Re: RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]

2021-05-20 Thread Сергей Цыпанов
On Thu, 20 May 2021 10:42:49 GMT, Claes Redestad wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8261880: Remove static from declarations of Holder nested classes > > Marked as

Re: RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]

2021-05-20 Thread Сергей Цыпанов
On Wed, 17 Feb 2021 16:38:03 GMT, Сергей Цыпанов wrote: >> Non-static classes hold a link to their parent classes, which in many cases >> can be avoided. > > Сергей Цыпанов has updated the pull request incrementally with one additional > commit since the last revision: &

Integrated: 8148937: (str) Adapt StringJoiner for Compact Strings

2021-03-17 Thread Сергей Цыпанов
On Thu, 18 Feb 2021 14:30:15 GMT, Сергей Цыпанов wrote: > Hello, > > as of now `java.util.StringJoiner` still uses `char[]` as a storage for > joined Strings. > > This applies for the cases when all joined Strings as well as delimiter, > prefix and suffix conta

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings [v2]

2021-03-15 Thread Сергей Цыпанов
On Mon, 15 Mar 2021 20:54:54 GMT, Claes Redestad wrote: >> Сергей Цыпанов has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contain

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings [v3]

2021-03-15 Thread Сергей Цыпанов
960.059 > ± 0.002 424.031 ± 0.001 B/op > stringJoiner:·gc.alloc.rate.norm 564 mixed 1760.088 > ± 0.003 744.041 ± 0.001 B/op > stringJoiner:·gc.alloc.rate.norm 10 8 mixed 664.052 > ±

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings

2021-03-15 Thread Сергей Цыпанов
On Mon, 15 Mar 2021 14:07:29 GMT, Claes Redestad wrote: >> I was thinking about `StringBuilder` at the very beginning but then decided >> to have no bounds checks and reallocations. Indeed from maintainability >> point of view your solution is much more attractive. I have one minor >> comment

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings [v2]

2021-03-15 Thread Сергей Цыпанов
960.059 > ± 0.002 424.031 ± 0.001 B/op > stringJoiner:·gc.alloc.rate.norm 564 mixed 1760.088 > ± 0.003 744.041 ± 0.001 B/op > stringJoiner:·gc.alloc.rate.norm 10 8 mixed 664.052 > ± 0.001 3

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings

2021-03-15 Thread Сергей Цыпанов
On Mon, 15 Mar 2021 12:36:24 GMT, Claes Redestad wrote: >> Hi @cl4es, >>> Some of these changes conflict with #2334, which suggest removing the >>> `coder` and `isLatin1` methods from `String`. >> >> I've checked out Aleksey's branch and applied my changes onto it, the only >> thing that I

Re: RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]

2021-02-25 Thread Сергей Цыпанов
On Wed, 24 Feb 2021 08:50:36 GMT, Alan Bateman wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8261880: Remove static from declarations of Holder nested classes > > src/java.b

Re: RFR: 8148937: (str) Adapt StringJoiner for Compact Strings

2021-02-18 Thread Сергей Цыпанов
On Thu, 18 Feb 2021 15:19:43 GMT, Claes Redestad wrote: >> Hello, >> >> as of now `java.util.StringJoiner` still uses `char[]` as a storage for >> joined Strings. >> >> This applies for the cases when all joined Strings as well as delimiter, >> prefix and suffix contain only ASCII symbols.

RFR: 8148937: (str) Adapt StringJoiner for Compact Strings

2021-02-18 Thread Сергей Цыпанов
Hello, as of now `java.util.StringJoiner` still uses `char[]` as a storage for joined Strings. This applies for the cases when all joined Strings as well as delimiter, prefix and suffix contain only ASCII symbols. As a result when `StringJoiner.toString()` is called `byte[]` stored in Strings

Re: RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]

2021-02-17 Thread Сергей Цыпанов
> Non-static classes hold a link to their parent classes, which in many cases > can be avoided. Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8261880: Remove static from declarations of Holder nested c

Re: RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]

2021-02-17 Thread Сергей Цыпанов
On Wed, 17 Feb 2021 16:24:46 GMT, Claes Redestad wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8261880: Remove static from declarations of Holder nested classes > > src/java.base/

RFR: 8261880: Change nested classes in java.base to static nested classes where possible

2021-02-17 Thread Сергей Цыпанов
Non-static classes hold a link to their parent classes, which in many cases can be avoided. - Commit messages: - 8261880: Change nested classes in java.base to static nested classes where possible Changes: https://git.openjdk.java.net/jdk/pull/2589/files Webrev:

Re: RFR: 8258852: Arrays.asList() for single item could be replaced with Collections.singletonList()

2020-12-28 Thread Сергей Цыпанов
On Thu, 24 Dec 2020 17:30:41 GMT, Xue-Lei Andrew Fan wrote: > > What about using List.of() instead? > > For now, the Collections.singletonList() is more compact, which uses one > class variable. While List.of(T) shares the internal implementation with > List.of(T t1, T t2), which uses two

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v8]

2020-12-21 Thread Сергей Цыпанов
On Mon, 21 Dec 2020 09:51:25 GMT, Andrey Turbanov wrote: >> src/java.base/share/classes/sun/security/tools/keytool/Main.java line 2459: >> >>> 2457: byte[] bytes = in.readAllBytes(); >>> 2458: return >>> CertificateFactory.getInstance("X509").generateCRLs( >>>

Re: RFR: 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo [v8]

2020-12-21 Thread Сергей Цыпанов
On Mon, 21 Dec 2020 09:16:11 GMT, Andrey Turbanov wrote: >> 8080272 Refactor I/O stream copying to use java.io.InputStream.transferTo > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8080272: Refactor I/O stream

Integrated: 8255299: Drop explicit zeroing at instantiation of Atomic* objects

2020-10-28 Thread Сергей Цыпанов
On Thu, 22 Oct 2020 20:46:15 GMT, Сергей Цыпанов wrote: > As discussed in https://github.com/openjdk/jdk/pull/510 there is never a > reason to explicitly instantiate any instance of `Atomic*` class with its > default value, i.e. `new AtomicInteger(0)` could be replaced

Re: RFR: 8255299: Drop explicit zeroing at instantiation of Atomic* objects [v2]

2020-10-28 Thread Сергей Цыпанов
On Wed, 28 Oct 2020 08:49:38 GMT, Sergey Bylokhov wrote: >> Rebased onto master to have the fix introduced in >> https://github.com/openjdk/jdk/pull/778 > > FYI it is better to use merge, instead of rebase+force push. Rebase breaks > history and all existed code comments. @mrserb thanks for

Re: RFR: 8255299: Drop explicit zeroing at instantiation of Atomic* objects [v2]

2020-10-28 Thread Сергей Цыпанов
On Sat, 24 Oct 2020 23:12:09 GMT, Phil Race wrote: >> Сергей Цыпанов has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains one add

Re: RFR: 8255299: Drop explicit zeroing at instantiation of Atomic* objects [v2]

2020-10-28 Thread Сергей Цыпанов
citValue avgt 30 11.846 ± 0.273 ns/op > So meanwhile https://bugs.openjdk.java.net/browse/JDK-8145948 is still in > progress we could trivially replace explicit zeroing with default > constructors gaining some performance benefit with no risk. > > I've tested the changes locally, both tier1 and tie

Re: RFR: 8255299: Drop explicit zeroing at instantiation of Atomic* objects

2020-10-23 Thread Сергей Цыпанов
On Fri, 23 Oct 2020 09:12:15 GMT, Daniel Fuchs wrote: >> As discussed in https://github.com/openjdk/jdk/pull/510 there is never a >> reason to explicitly instantiate any instance of `Atomic*` class with its >> default value, i.e. `new AtomicInteger(0)` could be replaced with `new >>

RFR: 8255299: Drop explicit zeroing at instantiation of Atomic* objects

2020-10-23 Thread Сергей Цыпанов
As discussed in https://github.com/openjdk/jdk/pull/510 there is never a reason to explicitly instantiate any instance of `Atomic*` class with its default value, i.e. `new AtomicInteger(0)` could be replaced with `new AtomicInteger()` which is faster: @State(Scope.Thread)

Integrated: 8251548 Remove unnecessary explicit initialization of volatile variables in security-libs code

2020-09-18 Thread Сергей Цыпанов
On Thu, 17 Sep 2020 08:09:31 GMT, Сергей Цыпанов wrote: > Hello, > > is it possible to have a code review for the changes proposed in JDK-8251548 > (originally contributed via > https://mail.openjdk.java.net/pipermail/security-dev/2020-June/022137.html)? > Sean Mullan ha

Re: Request for review of JDK-8251548

2020-09-18 Thread Сергей Цыпанов
as *.patch files in mail attachments. Anyway, OCA was approved again and the PR (https://github.com/openjdk/jdk/pull/218) is ready for review :) Cheers, Sergey 17.09.2020, 14:11, "David Holmes" : > On 17/09/2020 7:24 pm, Сергей Цыпанов wrote: >>  Hi David, >> >>  th

RFR: 8251548 Remove unnecessary explicit initialization of volatile variables in security-libs code

2020-09-17 Thread Сергей Цыпанов
Hello, is it possible to have a code review for the changes proposed in JDK-8251548 (originally contributed via https://mail.openjdk.java.net/pipermail/security-dev/2020-June/022137.html)? Sean Mullan has created an issue and web-review and can sponsor the patch as soos as it gets properly

Re: Request for review of JDK-8251548

2020-09-17 Thread Сергей Цыпанов
:22, "David Holmes" : > Hi Sergey, > > Since OpenJDK has moved to git/github, this needs to reformulated as a > Pull Request (PR). > > Cheers, > David > > On 17/09/2020 5:19 pm, Сергей Цыпанов wrote: >>  Hello, >> >>  is it possible to have a

Request for review of JDK-8251548

2020-09-17 Thread Сергей Цыпанов
Hello, is it possible to have a code review for the changes proposed in JDK-8251548? Sean Mullan has created an issue and web-review and can sponsor the patch as soos as it gets properly reviewed. As Doug Lea claims in

Re: [PATCH] remove redundant initialization of volatile fields with default values

2020-08-13 Thread Сергей Цыпанов
Cool, thanks! Do you know anyone who could sponsor this and create a web-review against the patch? Regards, Sergeyt Tsypanov 13.08.2020, 19:22, "Sean Mullan" : > On 8/13/20 9:04 AM, Сергей Цыпанов wrote: >>  Hi, >> >>  I don't have account in JBS, so I cannot f

Re: [PATCH] remove redundant initialization of volatile fields with default values

2020-08-13 Thread Сергей Цыпанов
I've mentioned in previous mail: https://bugs.openjdk.java.net/browse/JDK-8145680 Regards, Sergey Tsypanov 13.08.2020, 14:05, "Sean Mullan" : > On 8/13/20 7:04 AM, Сергей Цыпанов wrote: >>  Hello, >> >>  previously I've sent an email regarding removal of redun

[PATCH] remove redundant initialization of volatile fields with default values

2020-08-13 Thread Сергей Цыпанов
Hello, previously I've sent an email regarding removal of redundant assignments if default values to volatile fields, see https://mail.openjdk.java.net/pipermail/security-dev/2020-June/022137.html There was a concern whether it's completely safe to remove those assignments from JMM point of

[PATCH] remove redundant initialization of volatile fields with default values

2020-06-22 Thread Сергей Цыпанов
Hello, while investigating an issue I've found out that assignment of default value to volatile fields slows down object instantiation. Consider the benchmark: @State(Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(value = Mode.AverageTime) @Fork(jvmArgsAppend = {"-Xms2g",