Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Performance of Localized calendar initializations and Chronology.getAvailableChronologies() #263

Closed
RogerRiggs opened this Issue · 2 comments

2 participants

@RogerRiggs
Collaborator

The initial set of localized calendars had relatively light initializations, just creating the Chronology instance. As the Japanese and Hijrah Chronologies has been refined the amount of work needed to initialize the Chronology has increased. Reading the data for the Umm alQura calendar adds 30+ms to the initialization time.

Currently, the Chronology of, ofLocale, getAvailableChronologies all initialize all of the Chronologies to be able to return the complete set of Chronologies.

It would be better to initialize each Chronology only when it will be used by the application.
Two approaches are possible:
1. Change getAvailableChronologies to return the String ids of the chronologies and change the of method to initialize only the Chronology requested.
2. Change each of the heavyweight chronologies to create the Chronology instance as a quickly as possible and delay the reading of the data until it was needed. This may be more complex either by adding state within the Chronology or delegating to a separate class for the data.
3. Initially register a simple proxy for the Chronology that would initialize the data on first use and then replace itself in the list of registered Chronologies.

@jodastephen
Owner

I don't think I overly care, although I'm naturally drawn to option 2. I think there may be an argument for changing getAvailableChronologies to return String anyway, as per ZoneId

@RogerRiggs RogerRiggs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.