Closed omus closed 4 years ago
Merging #291 into master will decrease coverage by
0.01%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #291 +/- ##
==========================================
- Coverage 93.53% 93.51% -0.02%
==========================================
Files 31 32 +1
Lines 1531 1527 -4
==========================================
- Hits 1432 1428 -4
Misses 99 99
Impacted Files | Coverage Δ | |
---|---|---|
src/TimeZones.jl | 100.00% <ø> (ø) |
|
src/indexable_generator.jl | 100.00% <100.00%> (ø) |
|
src/interpret.jl | 100.00% <100.00%> (ø) |
|
src/types/variabletimezone.jl | 100.00% <100.00%> (ø) |
|
src/types/zoneddatetime.jl | 94.66% <100.00%> (+0.14%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 60ab3e9...e07eb66. Read the comment docs.
Increasing code coverage. Also removed no longer needed imports.
I'll apply my fixups
I'm performing some final validation (I definitely need to work on formalizing benchmarks for this package next) and have discovered a regression.
On Julia 1.5.1:
Current PR:
julia> @benchmark collect($(ZonedDateTime(2020, tz"America/Winnipeg"):Hour(1):ZonedDateTime(2021, tz"America/Winnipeg")))
BenchmarkTools.Trial:
memory estimate: 1.27 MiB
allocs estimate: 26381
--------------
minimum time: 1.054 ms (0.00% GC)
median time: 1.361 ms (0.00% GC)
mean time: 1.574 ms (5.58% GC)
maximum time: 9.904 ms (0.00% GC)
--------------
samples: 3175
evals/sample: 1
Current master (48fe988):
julia> @benchmark collect($(ZonedDateTime(2020, tz"America/Winnipeg"):Hour(1):ZonedDateTime(2021, tz"America/Winnipeg")))
BenchmarkTools.Trial:
memory estimate: 1.81 MiB
allocs estimate: 17588
--------------
minimum time: 787.054 μs (0.00% GC)
median time: 1.169 ms (0.00% GC)
mean time: 1.978 ms (6.01% GC)
maximum time: 107.202 ms (0.00% GC)
--------------
samples: 2526
evals/sample: 1
The increase in allocations is especially interesting. I'll try to get to the bottom of this before proceeding.
I've manged to address the regression and improve things further. It appears that the introduction of a function barrier when using a FixedTimeZone
resulted in the slowdown and increased allocations:
Current PR (1ed4d09):
julia> @benchmark collect($(ZonedDateTime(2020, tz"America/Winnipeg"):Hour(1):ZonedDateTime(2021, tz"America/Winnipeg")))
BenchmarkTools.Trial:
memory estimate: 755.44 KiB
allocs estimate: 8795
--------------
minimum time: 444.120 μs (0.00% GC)
median time: 683.956 μs (0.00% GC)
mean time: 859.080 μs (6.40% GC)
maximum time: 15.121 ms (0.00% GC)
--------------
samples: 5815
evals/sample: 1
Current master (48fe988):
julia> @benchmark collect($(ZonedDateTime(2020, tz"America/Winnipeg"):Hour(1):ZonedDateTime(2021, tz"America/Winnipeg")))
BenchmarkTools.Trial:
memory estimate: 1.81 MiB
allocs estimate: 17588
--------------
minimum time: 788.836 μs (0.00% GC)
median time: 998.876 μs (0.00% GC)
mean time: 1.210 ms (5.79% GC)
maximum time: 25.093 ms (0.00% GC)
--------------
samples: 4128
evals/sample: 1
Initially posted benchmarks in the description are still accurate.
Will merge on Monday. I want to get the benchmark suite merged in first
Due to unrelated time constraints I didn't get to this on Monday. The benchmark suite has now been added in #292 and I'll rebase these changes after I merge #293
Rebased to be able to use package benchmarks. Here's the results from running locally:
A ratio greater than 1.0
denotes a possible regression (marked with :x:), while a ratio less
than 1.0
denotes a possible improvement (marked with :white_check_mark:). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).
ID | time ratio | memory ratio |
---|---|---|
["ZonedDateTime", "date-period-range"] |
0.79 (5%) :white_check_mark: | 0.25 (1%) :white_check_mark: |
["ZonedDateTime", "local", "ambiguous"] |
0.38 (5%) :white_check_mark: | 0.14 (1%) :white_check_mark: |
["ZonedDateTime", "local", "standard"] |
0.76 (5%) :white_check_mark: | 0.16 (1%) :white_check_mark: |
["ZonedDateTime", "time-period-range"] |
0.59 (5%) :white_check_mark: | 0.41 (1%) :white_check_mark: |
["ZonedDateTime", "utc"] |
0.83 (5%) :white_check_mark: | 0.27 (1%) :white_check_mark: |
["arithmetic", "DatePeriod"] |
0.79 (5%) :white_check_mark: | 0.16 (1%) :white_check_mark: |
["arithmetic", "TimePeriod"] |
0.58 (5%) :white_check_mark: | 0.27 (1%) :white_check_mark: |
["interpret", "local", "ambiguous"] |
0.25 (5%) :white_check_mark: | 0.00 (1%) :white_check_mark: |
["interpret", "local", "non-existent"] |
0.47 (5%) :white_check_mark: | 0.00 (1%) :white_check_mark: |
["interpret", "local", "standard"] |
0.28 (5%) :white_check_mark: | 0.00 (1%) :white_check_mark: |
["interpret", "utc"] |
0.23 (5%) :white_check_mark: | 0.00 (1%) :white_check_mark: |
["parse", "issue#25"] |
1.03 (5%) | 0.75 (1%) :white_check_mark: |
["transition_range", "local", "ambiguous"] |
1.52 (5%) :x: | 1.00 (1%) |
["transition_range", "local", "non-existent"] |
1.35 (5%) :x: | 1.00 (1%) |
["transition_range", "local", "standard"] |
1.44 (5%) :x: | 1.00 (1%) |
["transition_range", "utc"] |
0.87 (5%) :white_check_mark: | 1.00 (1%) |
Here's a list of all the benchmark groups executed by this job:
["ZonedDateTime"]
["ZonedDateTime", "local"]
["arithmetic"]
["interpret", "local"]
["interpret"]
["parse"]
["transition_range", "local"]
["transition_range"]
["tryparsenext_fixedtz"]
["tryparsenext_tz"]
["tz_data"]
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
uname: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 18 20:50:10 PDT 2020; root:xnu-4903.278.43~1/RELEASE_X86_64 x86_64 i386
CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz:
speed user nice sys idle irq
#1 3500 MHz 101488 s 0 s 91551 s 655122 s 0 s
#2 3500 MHz 60850 s 0 s 33044 s 754262 s 0 s
#3 3500 MHz 103518 s 0 s 63707 s 680931 s 0 s
#4 3500 MHz 55042 s 0 s 27664 s 765450 s 0 s
Memory: 16.0 GB (53.5 MB free)
Uptime: 84816.0 sec
Load Avg: 3.88671875 3.37353515625 3.076171875
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
uname: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 18 20:50:10 PDT 2020; root:xnu-4903.278.43~1/RELEASE_X86_64 x86_64 i386
CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz:
speed user nice sys idle irq
#1 3500 MHz 101916 s 0 s 91652 s 655409 s 0 s
#2 3500 MHz 61195 s 0 s 33104 s 754674 s 0 s
#3 3500 MHz 103981 s 0 s 63800 s 681191 s 0 s
#4 3500 MHz 55372 s 0 s 27721 s 765880 s 0 s
Memory: 16.0 GB (115.89453125 MB free)
Uptime: 84898.0 sec
Load Avg: 9.79638671875 5.681640625 3.99462890625
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
The slowdown in the transition_range
tests are expected and are one of the main reasons we see massive improvements elsewhere. Just waiting on CI before merging.
Expected failure on macOS Julia nightly.
Is it worth even benchmarking transition_range
since it's not ever called by users? Could we benchmark functions that call it instead?
The function is still indirectly called by users. Having it benchmarked just makes it easier to track down sources of regressions
Fixes #289. While looking into ways to avoid having
interpret
create a vector I realized that improvements totransition_range
could result in us avoiding having to perform checks later ininterpret
. Doing this madetransition_range
slightly slower but allowed us to use a generator ininterpret
which avoided allocations. I then found myself wanting to index into a generator to avoid having to construct unnecessaryZonedDateTime
s which resulted in me creating theIndexableGenerator
(I'll try to make a Base PR for this). Finally, I noticed one more allocation in theZonedDateTime(dt::DateTime, tz::VariableTimeZone ; from_utc::Bool)
constructor which I addressed by introducing a function barrier.The end result brings us down to a single allocation for the
ZonedDateTime
and zero allocation when using the isbits type PR.Benchmarks on Julia 1.5.1:
PR:
Current master (48fe988):