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

deprecate vectorized methods hiding in Dates #23207

Merged
merged 4 commits into from
Aug 12, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Aug 10, 2017

This pull request gleefully deprecates a few vectorized methods that were hiding in Dates. Addresses #23167. Best!

@Sacha0 Sacha0 added domain:dates Dates, times, and the Dates stdlib module kind:deprecation This change introduces or involves a deprecation domain:io Involving the I/O subsystem: libuv, read, write, etc. domain:broadcast Applying a function over a collection labels Aug 10, 2017
@ararslan ararslan requested a review from omus August 11, 2017 00:18
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
Copy link
Member

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.

Copy link
Member Author

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! :)

@omus
Copy link
Member

omus commented Aug 11, 2017

I forgot to post this last night. The broadcasting performance when you are not using the dateformat string macro is pretty terrible:

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 Date(::AbstractString, ::AbstractString) constructor as well. That can be for another PR.

@quinnj
Copy link
Member

quinnj commented Aug 12, 2017

I agree @omus, we should deprecate the string method. This looks great, thanks.

@Sacha0
Copy link
Member Author

Sacha0 commented Aug 12, 2017

Thanks all! :)

@Sacha0 Sacha0 deleted the depvecdates branch August 12, 2017 04:34

@test Dates.format(dr2) == dr
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:broadcast Applying a function over a collection domain:dates Dates, times, and the Dates stdlib module domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants