Closed Aubineau closed 9 years ago
@Aubineau I don't think this project is being actively maintained.
Consider closing this issue and re-posting it at https://github.com/ThreeTen/threeten-extra
Created OpenJDK matching issue: https://bugs.openjdk.java.net/browse/JDK-8066291
Every time you parse a ZonedDateTime that contains a zone id the method ZoneRulesProvider.getAvailableZoneIds() is called in the ZoneIdPrinterParser.
This method can be very costly. Since there is already a cache to avoid to recreate the SubstringTree it should be possible to call the ZoneRulesProvider.getAvailableZoneIds() method only when this cache is updated.
For example something like
Set regionIds = cachedRegionIds;
final int regionIdsSize = ZoneRulesProvider.getAvailableZoneIdsSize(); // Return only the size of ZONES in ZoneRulesProvider
Entry<Integer, SubstringTree> cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
cachedRegionIds = ZoneRulesProvider.getAvailableZoneIds();
...
Instead of
Set regionIds = ZoneRulesProvider.getAvailableZoneIds();
final int regionIdsSize = regionIds.size();
Entry<Integer, SubstringTree> cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
...
Eric