Defer loading the cache for constructing fixed time zones#463
Draft
Defer loading the cache for constructing fixed time zones#463
Conversation
Member
Author
|
Before this PR on Julia 1.9.4: julia> @time_imports using TimeZones
0.5 ms Scratch
8.1 ms Preferences
0.4 ms PrecompileTools
18.4 ms Parsers
4.3 ms InlineStrings
0.4 ms TZJData
0.7 ms Compat
0.3 ms Compat → CompatLinearAlgebraExt
0.3 ms ExprTools
0.6 ms Mocking
25.9 ms TimeZones
julia> @time TimeZone("UTC")
0.068178 seconds (321.75 k allocations: 13.138 MiB, 16.41% gc time, 22.11% compilation time)
UTC
julia> @time TimeZone("Europe/Warsaw")
0.000008 seconds (2 allocations: 64 bytes)
Europe/Warsaw (UTC+1/UTC+2)
julia> @time TimeZone("UTC")
0.000004 seconds (2 allocations: 64 bytes)
UTCWith this PR on Julia 1.9.4: julia> @time_imports using TimeZones
0.5 ms Scratch
8.2 ms Preferences
0.4 ms PrecompileTools
18.2 ms Parsers
4.4 ms InlineStrings
0.4 ms TZJData
0.7 ms Compat
0.3 ms Compat → CompatLinearAlgebraExt
0.3 ms ExprTools
0.6 ms Mocking
26.1 ms TimeZones
julia> @time TimeZone("UTC")
0.000093 seconds (6 allocations: 368 bytes)
UTC
julia> @time TimeZone("Europe/Warsaw")
0.089128 seconds (321.75 k allocations: 13.138 MiB, 17.40% gc time, 33.12% compilation time)
Europe/Warsaw (UTC+1/UTC+2)
julia> @time TimeZone("UTC")
0.000020 seconds (6 allocations: 368 bytes)
UTCThere is a minor trade off here as we now always create the fixed time zone instead of loading it from the cache if it exists. |
Member
Author
|
I have some concerns about the lazy loading now. We seem to just be passing the buck on performing the cache initialization. I especially don't like it now that packages which use time zones may see bad timings with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempting to address this problem: apache/arrow-julia#482 (comment). The problem is that packages which use
@tz_strorTimeZoneat the top-level will end up triggering the lazy TZ cache load during there package initialization. For packages that just use theClass(:FIXED)time zones (e.g. "UTC") we can defer the TZ cache loading.