-
Notifications
You must be signed in to change notification settings - Fork 58
Eliminate allocation with ZonedDateTime constructor using is_dst::Bool
#502
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
Conversation
ZonedDateTime constructor using is_dst::Bool
|
Julia 1.10.10, 1.11.7, 1.12.2, and 1.14.0-DEV.1310 all report this on the REPL: julia> @allocated ZonedDateTime(DateTime(2025, 7, 18, 22, 5), tz"Europe/Berlin", true)
0I'm not sure why I see allocations in the tests on Julia 1.12.2 and 1.14.0-DEV.1310 but this overall seems like an improvement. |
src/types/zoneddatetime.jl
Outdated
| elseif num == 0 | ||
| throw(NonExistentTimeError(dt, tz)) | ||
| elseif num == 2 | ||
| possible = [first(possible), last(possible)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I didn't need this after all
Code coverage is effectful and in v1.12+ it tends to cause extra allocations. |
Good to know. That may not be the root cause here though since |
Fixes #495. We now no longer see allocations when using
ZonedDateTime(dt, tz, is_dst::Bool)when the local date/time is not ambiguous. We still see allocations when it is ambiguous though.