-
Bug
-
Resolution: Fixed
-
P4
-
8
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 cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
cachedRegionIds = ZoneRulesProvider.getAvailableZoneIds();
...
Instead of
Set regionIds = ZoneRulesProvider.getAvailableZoneIds();
final int regionIdsSize = regionIds.size();
Entry cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
...
Originally proposed as https://github.com/ThreeTen/threeten/issues/350
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 cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
cachedRegionIds = ZoneRulesProvider.getAvailableZoneIds();
...
Instead of
Set regionIds = ZoneRulesProvider.getAvailableZoneIds();
final int regionIdsSize = regionIds.size();
Entry cached = cachedSubstringTree;
if (cached == null || cached.getKey() != regionIdsSize) {
...
Originally proposed as https://github.com/ThreeTen/threeten/issues/350