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 u

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

2022-07-20 Thread Andrey Turbanov
On Wed, 6 Jul 2022 14:11:39 GMT, Roger Riggs wrote: >> @RogerRiggs in my view, it's not about performance per se… I'll sometimes >> help along these kinds of small fix PRs (that are more likely than not >> driven by IntelliJ code refactoring suggestions) if I think they lead to >> more idiomat

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

2022-07-07 Thread Roger Riggs
On Tue, 5 Jul 2022 21:27:16 GMT, Attila Szegedi wrote: >> Can there be some JMH tests to confirm the performance? >> The value domain of the keys is pretty limited (7 * 7) max; and I'm not sure >> that the combination of creating a new record and the hashcode and equals >> methods would be fast

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-05 Thread Roger Riggs
On Sun, 3 Jul 2022 22:06:58 GMT, Attila Szegedi wrote: >> src/java.base/share/classes/java/time/format/DateTimeTextProvider.java line >> 312: >> >>> 310: private Object findStore(TemporalField field, Locale locale) { >>> 311: Entry key = createEntry(field, locale); >>> 312:

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

2022-07-05 Thread Andrey Turbanov
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-05 Thread Andrey Turbanov
On Sun, 3 Jul 2022 19:47:16 GMT, Attila Szegedi 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 sho

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

2022-07-04 Thread Andrey Turbanov
On Sun, 3 Jul 2022 19:44:55 GMT, Attila Szegedi wrote: >> But it will generate garbage: non-static lambda. > > It already generates some garbage as it does string concatenation for the > key. Here's an idea: declare a record class for the key, `record > CacheKey(DayOfWeek firstDayOfWeek, int mi

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 st

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

2022-07-03 Thread liach
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: Avo

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: Avo

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

2022-06-28 Thread Andrey Turbanov
On Fri, 24 Jun 2022 07:22:05 GMT, Jaikiran Pai 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 shor

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

2022-06-24 Thread Jaikiran Pai
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: Avo

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

2022-06-22 Thread Andrey Turbanov
> 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: Avoid redundant ConcurrentHashMap.get call in java.time use computeIfAb