Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-05-22 Thread Per Minborg
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-04-19 Thread Chen Liang
On Tue, 21 Mar 2023 13:53:27 GMT, Chen Liang wrote: >> It is possible but this keeps the mapper more local and only accessible >> where it is supposed to be used. For testing purposed, it might be better to >> have the class as you propose. > > If we want it local, I suppose we can convert the

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-04-19 Thread Chen Liang
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-04-19 Thread Per Minborg
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-21 Thread Chen Liang
On Tue, 21 Mar 2023 07:25:38 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/time/ZoneOffset.java line 430: >> >>> 428: public static ZoneOffset ofTotalSeconds(int totalSeconds) { >>> 429: final class Holder { >>> 430: private static final IntFunction >>> ZON

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-21 Thread Chen Liang
On Tue, 21 Mar 2023 07:29:49 GMT, Per Minborg wrote: >> It can. I think either works fine. Maybe a bit nicer with a method reference >> as you propose. > > Perhaps you mean the method could be *replaced* with `Integer::valueOf"? Good > suggestion. Yes, `Integer::valueOf` is a better replacemen

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-21 Thread Per Minborg
On Mon, 20 Mar 2023 18:12:01 GMT, Chen Liang wrote: >> Per Minborg has updated the pull request incrementally with three additional >> commits since the last revision: >> >> - Remove unused setup method >> - Rename method in test >> - Add copyright header > > src/java.base/share/classes/java

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-21 Thread Per Minborg
On Tue, 21 Mar 2023 07:27:59 GMT, Per Minborg wrote: >> test/jdk/jdk/internal/util/LazyReferenceArray/BasicLazyReferenceArrayTest.java >> line 107: >> >>> 105: >>> 106: private static IntFunction intIdentity() { >>> 107: return i -> i; >> >> Can't this be `Integer::valueOf`? > > I

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-20 Thread Chen Liang
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-03-20 Thread Per Minborg
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-02-20 Thread Per Minborg
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-02-10 Thread Roger Riggs
On Thu, 9 Feb 2023 13:46:14 GMT, Per Minborg wrote: >> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for >> values in the range [-18h, 18h] for each second that is on an even quarter >> of an hour (i.e. at most 2*18*4+1 = 145 values). >> >> Instead of using a `ConcurrentH

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v8]

2023-02-09 Thread Per Minborg
> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for values > in the range [-18h, 18h] for each second that is on an even quarter of an > hour (i.e. at most 2*18*4+1 = 145 values). > > Instead of using a `ConcurrentHashMap` for caching instanced, we could > instead use an `