RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]
Andrey Turbanov
aturbanov at openjdk.org
Tue Jul 5 20:53:42 UTC 2022
On Tue, 5 Jul 2022 15:26:06 GMT, Roger Riggs <rriggs at openjdk.org> 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 to disassemble the bytecode of a little test program to see whether it's the case.
>
> 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 faster than string concat of a constant and a single digit integer.
@RogerRiggs is you comment about `DateTimeTextProvider.findStore` or `WeekFields.of`?
There is no record creation here, in `DateTimeTextProvider.findStore`.
-------------
PR: https://git.openjdk.org/jdk/pull/9208
More information about the core-libs-dev
mailing list