Closed oxinabox closed 4 years ago
Merging #283 into master will increase coverage by
1.16%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #283 +/- ##
==========================================
+ Coverage 92.41% 93.58% +1.16%
==========================================
Files 30 30
Lines 1398 1528 +130
==========================================
+ Hits 1292 1430 +138
+ Misses 106 98 -8
Impacted Files | Coverage Δ | |
---|---|---|
src/parse.jl | 94.44% <100.00%> (+0.17%) |
:arrow_up: |
src/build.jl | 100.00% <0.00%> (ø) |
|
src/rounding.jl | 100.00% <0.00%> (ø) |
|
src/TimeZones.jl | 100.00% <0.00%> (ø) |
|
src/adjusters.jl | 100.00% <0.00%> (ø) |
|
src/interpret.jl | 100.00% <0.00%> (ø) |
|
src/conversions.jl | 100.00% <0.00%> (ø) |
|
src/tzdata/archive.jl | 100.00% <0.00%> (ø) |
|
src/types/fixedtimezone.jl | 100.00% <0.00%> (ø) |
|
src/utils.jl | 97.56% <0.00%> (+0.06%) |
:arrow_up: |
... and 18 more |
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 cf53361...b5a8b19. Read the comment docs.
Looks good. Would be good to post before/after benchmarks for the record
For benchmarking:
using Dates
using TimeZones
using Test
using BenchmarkTools
@btime parse(ZonedDateTime, "2017-11-14 11:03:53 +0100", dateformat"yyyy-mm-dd HH:MM:SS zzzzz");
parse(ZonedDateTime, "2016-04-11 08:00 UTC", dateformat"yyyy-mm-dd HH:MM ZZZ");
@btime parse(ZonedDateTime, "2000+00", dateformat"yyyyz");
@btime parse(ZonedDateTime, Test.GenericString("2018-01-01 00:00 UTC"), dateformat"yyyy-mm-dd HH:MM ZZZ");
@btime tryparse(ZonedDateTime, "2013-03-20 11:00:00+04:00", dateformat"y-m-d H:M:SSz");
@btime tryparse(ZonedDateTime, "2016-04-11 08:00 EST", dateformat"yyyy-mm-dd HH:MM zzz");
@btime ZonedDateTime("2000-01-02T03:04:05.006+0700");
@btime ZonedDateTime("2000-01-02T03:04:05.006Z");
@btime ZonedDateTime("2018-11-01-0600", dateformat"yyyy-mm-ddzzzz");
julia> @btime parse(ZonedDateTime, "2017-11-14 11:03:53 +0100", dateformat"yyyy-mm-dd HH:MM:SS zzzzz");
711.052 ns (13 allocations: 592 bytes)
julia> @btime parse(ZonedDateTime, "2000+00", dateformat"yyyyz");
462.727 ns (13 allocations: 496 bytes)
julia> @btime parse(ZonedDateTime, Test.GenericString("2018-01-01 00:00 UTC"), dateformat"yyyy-mm-dd HH:MM ZZZ");
9.642 μs (138 allocations: 4.48 KiB)
julia> @btime tryparse(ZonedDateTime, "2013-03-20 11:00:00+04:00", dateformat"y-m-d H:M:SSz");
882.300 ns (14 allocations: 640 bytes)
julia> @btime tryparse(ZonedDateTime, "2016-04-11 08:00 EST", dateformat"yyyy-mm-dd HH:MM zzz");
95.112 ns (0 allocations: 0 bytes)
julia> @btime ZonedDateTime("2000-01-02T03:04:05.006+0700");
880.255 ns (14 allocations: 688 bytes)
julia> @btime ZonedDateTime("2000-01-02T03:04:05.006Z");
628.000 ns (9 allocations: 416 bytes)
julia> @btime ZonedDateTime("2018-11-01-0600", dateformat"yyyy-mm-ddzzzz");
618.410 ns (13 allocations: 544 bytes)
julia> @btime parse(ZonedDateTime, "2017-11-14 11:03:53 +0100", dateformat"yyyy-mm-dd HH:MM:SS zzzzz");
695.917 ns (13 allocations: 592 bytes)
julia> @btime parse(ZonedDateTime, "2000+00", dateformat"yyyyz");
464.194 ns (13 allocations: 496 bytes)
julia> @btime parse(ZonedDateTime, Test.GenericString("2018-01-01 00:00 UTC"), dateformat"yyyy-mm-dd HH:MM ZZZ");
9.510 μs (138 allocations: 4.48 KiB)
julia> @btime tryparse(ZonedDateTime, "2013-03-20 11:00:00+04:00", dateformat"y-m-d H:M:SSz");
871.731 ns (14 allocations: 640 bytes)
julia> @btime tryparse(ZonedDateTime, "2016-04-11 08:00 EST", dateformat"yyyy-mm-dd HH:MM zzz");
93.762 ns (0 allocations: 0 bytes)
julia> @btime ZonedDateTime("2000-01-02T03:04:05.006+0700");
827.987 ns (14 allocations: 688 bytes)
julia> @btime ZonedDateTime("2000-01-02T03:04:05.006Z");
629.190 ns (9 allocations: 416 bytes)
julia> @btime ZonedDateTime("2018-11-01-0600", dateformat"yyyy-mm-ddzzzz");
612.110 ns (13 allocations: 544 bytes)
So a small but consistent improvement. Not actually with the time it too to make the PR probably. but OTOH we do parse something like 10^12 zoned date times each year, so that probably does actually mean this adds up to a few minutes.
Micro benchmark isn't effective here:
julia> c = '0'
'0': ASCII/Unicode U+0030 (category Nd: Number, decimal digit)
julia> @btime $c === 'Z'
0.033 ns (0 allocations: 0 bytes)
false
julia> @btime $c == 'Z'
0.033 ns (0 allocations: 0 bytes)
false
one of the items from #282
A follow up PR might like to do for
Int
s also.