This repository has been archived by the owner. It is now read-only.

ZoneIdPrinterParser can be optimized #350

Closed
Aubineau opened this Issue Jan 30, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@Aubineau

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

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Nov 27, 2014

@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

cowwoc commented Nov 27, 2014

@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

@RogerRiggs

This comment has been minimized.

Show comment
Hide comment
@RogerRiggs

RogerRiggs Dec 1, 2014

Contributor

Created OpenJDK matching issue: https://bugs.openjdk.java.net/browse/JDK-8066291

Contributor

RogerRiggs commented Dec 1, 2014

Created OpenJDK matching issue: https://bugs.openjdk.java.net/browse/JDK-8066291

@RogerRiggs RogerRiggs closed this Dec 1, 2014

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.