Closed KristofferC closed 1 month ago
Rebased this PR now that #456 has been merged
Posting some benchmarks from my machine so I can do some refactoring without losing the performance gains.
Before this PR with Julia 1.11.0-beta1 on an M1 MacBook
julia> @time_imports import TimeZones
...
┌ 4.4 ms TimeZones.TZData.__init__() 53.17% compilation time
├ 318.6 ms TimeZones.__init__() 85.10% compilation time (93% recompilation)
690.8 ms TimeZones 59.42% compilation time (85% recompilation)
julia> using BenchmarkTools, TimeZones
julia> @btime istimezone("Europe/Warsaw");
77.314 ns (1 allocation: 16 bytes)
With this PR with Julia 1.11.0-beta1 on an M1 MacBook
julia> @time_imports import TimeZones
...
┌ 3.7 ms TimeZones.TZData.__init__() 56.80% compilation time
├ 0.0 ms TimeZones.__init__()
107.0 ms TimeZones 83.43% compilation time (53% recompilation)
julia> using BenchmarkTools, TimeZones
julia> @btime istimezone("Europe/Warsaw");
80.966 ns (1 allocation: 16 bytes)
Commit 5701f3a3c67c7dd3da9579c22414e9e7236a89b6
julia> @time_imports import TimeZones
...
┌ 3.1 ms TimeZones.TZData.__init__() 77.56% compilation time
├ 0.0 ms TimeZones.__init__()
106.5 ms TimeZones 84.26% compilation time (54% recompilation)
julia> using BenchmarkTools, TimeZones
julia> @btime istimezone("Europe/Warsaw");
78.689 ns (1 allocation: 16 bytes)
Commit b5948fc5e593d2a52087d5b835e1dcd05876f31d
julia> @time_imports import TimeZones
...
0.6 ms Mocking
┌ 2.5 ms TimeZones.TZData.__init__() 81.56% compilation time
├ 0.0 ms TimeZones.__init__()
108.0 ms TimeZones 79.75% compilation time (53% recompilation)
julia> using BenchmarkTools, TimeZones
julia> @btime istimezone("Europe/Warsaw");
75.703 ns (1 allocation: 16 bytes)
Looks like I broke some tests in the process
Attention: Patch coverage is 91.66667%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 92.67%. Comparing base (
2bc8f50
) to head (d900457
). Report is 3 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
src/build.jl | 0.00% | 1 Missing :warning: |
src/types/timezone.jl | 95.00% | 1 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Close to the finish line on this one. I'd like to recheck the performance with the fixed tests yet.
This avoids having to compile a bunch of code in
__init__
and improves the load time of the package (on Julia 1.11) from:The change in performance of the functions is (in my opinion) acceptable.
After:
Before: