Re: RFR: 8325679: Optimize ArrayList subList sort [v4]

2024-05-09 Thread Attila Szegedi
On Mon, 19 Feb 2024 10:05:24 GMT, Attila Szegedi wrote: >> Somewhat surprisingly, `ArrayList$Sublist.sort()` is not specialized and >> will thus fall back to slower default method of `List.sort()` instead of >> sorting a range of the array in-place in its backi

Re: RFR: 8325679: Optimize ArrayList subList sort

2024-04-11 Thread Attila Szegedi
On Wed, 14 Feb 2024 23:37:03 GMT, Stuart Marks wrote: >> Somewhat surprisingly, `ArrayList$Sublist.sort()` is not specialized and >> will thus fall back to slower default method of `List.sort()` instead of >> sorting a range of the array in-place in its backing root `ArrayList`. >> >> This

Re: RFR: 8325679: Optimize ArrayList subList sort [v4]

2024-02-19 Thread Attila Szegedi
n't added tests, and `tier1` > tests still all pass except for > `test/jdk/java/util/Locale/LocaleProvidersFormat.java` which also currently > fails on master too on the machine I tested on. Attila Szegedi has updated the pull request incrementally with one additional commit since the

Re: RFR: 8325679: Optimize ArrayList subList sort [v3]

2024-02-19 Thread Attila Szegedi
n't added tests, and `tier1` > tests still all pass except for > `test/jdk/java/util/Locale/LocaleProvidersFormat.java` which also currently > fails on master too on the machine I tested on. Attila Szegedi has refreshed the contents of this pull request, and previous commits have been

Re: RFR: 8325679: Optimize ArrayList subList sort

2024-02-18 Thread Attila Szegedi
On Wed, 14 Feb 2024 23:37:03 GMT, Stuart Marks wrote: >> Somewhat surprisingly, `ArrayList$Sublist.sort()` is not specialized and >> will thus fall back to slower default method of `List.sort()` instead of >> sorting a range of the array in-place in its backing root `ArrayList`. >> >> This

Re: RFR: 8325679: Optimize ArrayList subList sort [v2]

2024-02-18 Thread Attila Szegedi
n't added tests, and `tier1` > tests still all pass except for > `test/jdk/java/util/Locale/LocaleProvidersFormat.java` which also currently > fails on master too on the machine I tested on. Attila Szegedi has updated the pull request incrementally with one additional commit since the last

Re: RFR: 8325679: Optimize ArrayList subList sort

2024-02-13 Thread Attila Szegedi
On Tue, 13 Feb 2024 03:55:37 GMT, Stuart Marks wrote: >> Somewhat surprisingly, `ArrayList$Sublist.sort()` is not specialized and >> will thus fall back to slower default method of `List.sort()` instead of >> sorting a range of the array in-place in its backing root `ArrayList`. >> >> This

RFR: 8325679: Optimize ArrayList subList sort

2024-02-12 Thread Attila Szegedi
Somewhat surprisingly, `ArrayList$Sublist.sort()` is not specialized and will thus fall back to slower default method of `List.sort()` instead of sorting a range of the array in-place in its backing root `ArrayList`. This doesn't change observable behavior, so haven't added tests, and `tier1`

Re: RFR: 8310995: missing @since tags in 36 jdk.dynalink classes

2024-01-08 Thread Attila Szegedi
On Mon, 8 Jan 2024 13:24:55 GMT, Athijegannathan Sundararajan wrote: > Adding missing "@ since 9" in javadoc comment of the public classes, > interfaces and packages of the jdk.dynalink module. Marked as reviewed by attila (Reviewer). - PR Review:

Re: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2]

2023-01-22 Thread Attila Szegedi
On Mon, 9 Jan 2023 08:33:09 GMT, Viktor Klang wrote: >> Currently Set.copyOf allocates both a HashSet and a new empty array when the >> input collection is empty. >> >> This patch avoids allocating anything for the case where the parameter >> collection's isEmpty returns true. > > Viktor

Re: RFR: 8299852: Modernize ConcurrentHashMap [v2]

2023-01-22 Thread Attila Szegedi
On Thu, 12 Jan 2023 09:28:46 GMT, Per Minborg wrote: >> `java.util.concurrent.ConcurrentHashMap` is relatively old and has not been >> updated to reflect the current state of Java and can be modernized: >> >> * Add `@Serial` annotations >> * Seal classes and restrict subclassing for internal

Thread Weak Local / Thread Rental

2022-09-27 Thread Attila Szegedi
Hey folks, I’ve been looking at some performance bottlenecks in a system recently, and found that we have some that stem from synchronizing on a SimpleDateFormat (which, as we know, isn’t thread safe.) This got me thinking about switching to a ThreadLocal of them, but I realized that I don’t

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-20 Thread Attila Szegedi
On Wed, 20 Jul 2022 11:19:11 GMT, Andrey Turbanov wrote: >> The comment was about WeekFields.of(), I misplaced the comment. >> >> @szegedi All good points about modernizing code... >> One of the reasons to ask about specific performance data is to validate the >> general performance impact of

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v4]

2022-07-20 Thread Attila Szegedi
On Wed, 20 Jul 2022 11:19:07 GMT, Andrey Turbanov wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8288723:

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v3]

2022-07-10 Thread Attila Szegedi
On Mon, 4 Jul 2022 07:06:30 GMT, Andrey Turbanov wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8288723:

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-06 Thread Attila Szegedi
On Tue, 5 Jul 2022 15:26:06 GMT, Roger Riggs wrote: >> Well, if you _really_ want to noodle this for performance, you can also >> store a `this`-bound lambda in a `private final` instance field, so then >> it's only created once too. I wouldn't put it past `javac` to do this, but >> I'd have

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-03 Thread Attila Szegedi
On Sun, 3 Jul 2022 20:42:53 GMT, liach wrote: >> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8288723: Avoid redundant ConcurrentHashMap.get call in java.time >> use computeIfAbsent where lambda could be short and

Re: RFR: 8289431: (zipfs) Avoid redundant HashMap.get in ZipFileSystemProvider.removeFileSystem [v2]

2022-07-03 Thread Attila Szegedi
On Wed, 29 Jun 2022 08:20:31 GMT, Andrey Turbanov wrote: >> There is overload method HashMap.remove(key,value) which also checks value >> equality. >> It's shorter and faster than pair get+remove. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since

Re: RFR: 8289484: Cleanup unnecessary null comparison before instanceof check in java.rmi

2022-07-03 Thread Attila Szegedi
On Wed, 29 Jun 2022 21:11:09 GMT, Andrey Turbanov wrote: > Update code checks both non-null and instance of a class in jdk.hotspot.agent > module classes. > The checks and explicit casts could also be replaced with pattern matching > for the instanceof operator. > > For example, the following

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-03 Thread Attila Szegedi
On Tue, 28 Jun 2022 07:27:30 GMT, Andrey Turbanov wrote: >> src/java.base/share/classes/java/time/temporal/WeekFields.java line 331: >> >>> 329: String key = firstDayOfWeek.toString() + >>> minimalDaysInFirstWeek; >>> 330: WeekFields rules = CACHE.get(key); >>> 331: if

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

2022-07-03 Thread Attila Szegedi
On Wed, 22 Jun 2022 21:29:50 GMT, Andrey Turbanov wrote: >> Instead of separate ConcurrentHashMap.get call, we can use result of >> previous putIfAbsent call. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8288723:

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-06-21 Thread Attila Szegedi
On Mon, 20 Jun 2022 15:01:55 GMT, liach wrote: >> src/java.base/share/classes/java/time/format/DateTimeTextProvider.java line >> 319: >> >>> 317: store = prev; >>> 318: } >>> 319: } >> >> You could do better here and use `computeIfAbsent` with `createStore`

Re: RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time

2022-06-20 Thread Attila Szegedi
On Sat, 18 Jun 2022 10:43:08 GMT, Andrey Turbanov wrote: > Instead of separate ConcurrentHashMap.get call, we can use result of previous > putIfAbsent call. src/java.base/share/classes/java/time/format/DateTimeTextProvider.java line 319: > 317: store = prev; > 318: