-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
deprecate vectorized methods hiding in Dates #23207
Conversation
test/dates/io.jl
Outdated
@test Dates.Date(dr) == dr2 | ||
@test Dates.Date(dr, "yyyy-mm-dd") == dr2 | ||
@test Dates.Date.(dr) == dr2 | ||
@test Dates.Date.(dr, "yyyy-mm-dd") == dr2 |
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.
Tests will be more performant if we change this to use the dateformat
string macro.
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.
Changed these Date
and DateTime
tests to use the dateformat
string macro. Thanks! :)
I forgot to post this last night. The broadcasting performance when you are not using the julia> using BenchmarkTools
julia> dr = ["2000-01-01", "2000-01-02", "2000-01-03", "2000-01-04", "2000-01-05",
"2000-01-06", "2000-01-07", "2000-01-08", "2000-01-09", "2000-01-10"];
julia> @benchmark Date($dr, "yyyy-mm-dd") # deprecated
BenchmarkTools.Trial:
memory estimate: 4.47 KiB
allocs estimate: 104
--------------
minimum time: 17.368 μs (0.00% GC)
median time: 19.149 μs (0.00% GC)
mean time: 23.571 μs (16.24% GC)
maximum time: 32.019 ms (94.77% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark Date($dr, dateformat"yyyy-mm-dd") # deprecated
BenchmarkTools.Trial:
memory estimate: 528 bytes
allocs estimate: 13
--------------
minimum time: 465.571 ns (0.00% GC)
median time: 473.120 ns (0.00% GC)
mean time: 567.269 ns (6.44% GC)
maximum time: 141.774 μs (99.63% GC)
--------------
samples: 10000
evals/sample: 196
julia> @benchmark Date.($dr, "yyyy-mm-dd")
BenchmarkTools.Trial:
memory estimate: 40.86 KiB
allocs estimate: 949
--------------
minimum time: 182.903 μs (0.00% GC)
median time: 191.881 μs (0.00% GC)
mean time: 205.410 μs (4.52% GC)
maximum time: 32.989 ms (93.24% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark Date.($dr, dateformat"yyyy-mm-dd")
BenchmarkTools.Trial:
memory estimate: 480 bytes
allocs estimate: 11
--------------
minimum time: 443.898 ns (0.00% GC)
median time: 449.193 ns (0.00% GC)
mean time: 488.670 ns (7.16% GC)
maximum time: 143.805 μs (99.62% GC)
--------------
samples: 10000
evals/sample: 197 Maybe we should deprecate the |
I agree @omus, we should deprecate the string method. This looks great, thanks. |
Thanks all! :) |
|
||
@test Dates.format(dr2) == dr |
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.
could this test have been kept but with a dot, or is there no 1-arg format
any more?
This pull request gleefully deprecates a few vectorized methods that were hiding in
Dates
. Addresses #23167. Best!