Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add caching mechanism for TZif lookups #18

Open
BurntSushi opened this issue Jul 10, 2024 · 0 comments
Open

add caching mechanism for TZif lookups #18

BurntSushi opened this issue Jul 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@BurntSushi
Copy link
Owner

When doing conversions to and from Zoned values, one thing that shows up on the profile are TZif lookups. Every lookup needs to do a binary search of some kind.

My guess is that the binary search can probably be skipped in most cases at the expense of checking transitions near either the current time or the most recently requested lookup. The current time could be used at construction and so sidesteps problems of synchronization during caching, but could become stale in a longer running process. But perhaps that staleness is fine.

Note that I believe we can afford to spend a fair amount of effort (and perhaps even memory) at TZif construction time, since TZif construction generally happens ~once for each time zone. (That part is already cached.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant