-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add some precompiles #370
Add some precompiles #370
Conversation
Would you mind to kindly point out where related documentation can be found? This topic looks interesting |
Does precompiling have side effects? julia> versioninfo()
Julia Version 1.3.0
Commit 46ce4d7933 (2019-11-26 06:09 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake) masterjulia> @time parse(RGB{Float32}, "#C0FFEE")
0.233481 seconds (981.38 k allocations: 50.342 MiB, 4.99% gc time)
RGB{Float32}(0.7529412f0,1.0f0,0.93333334f0)
julia> @time parse(RGB{Float32}, "#C0FFEE")
0.000017 seconds (13 allocations: 576 bytes)
RGB{Float32}(0.7529412f0,1.0f0,0.93333334f0)
julia> @time parse(Colorant, "#C0FFEE")
0.001666 seconds (1.94 k allocations: 116.674 KiB)
RGB{N0f8}(0.753,1.0,0.933)
julia> @time parse(Colorant, "#C0FFEE")
0.000010 seconds (11 allocations: 512 bytes)
RGB{N0f8}(0.753,1.0,0.933) teh/precompilejulia> @time parse(RGB{Float32}, "#C0FFEE")
0.098095 seconds (115.82 k allocations: 6.166 MiB)
RGB{Float32}(0.7529412f0,1.0f0,0.93333334f0)
julia> @time parse(RGB{Float32}, "#C0FFEE")
0.000014 seconds (14 allocations: 592 bytes)
RGB{Float32}(0.7529412f0,1.0f0,0.93333334f0)
julia> @time parse(Colorant, "#C0FFEE")
0.001681 seconds (1.94 k allocations: 116.439 KiB)
RGB{N0f8}(0.753,1.0,0.933)
julia> @time parse(Colorant, "#C0FFEE")
0.000010 seconds (12 allocations: 528 bytes)
RGB{N0f8}(0.753,1.0,0.933) Edit: (This is a off-topic, but I should have added |
Codecov Report
@@ Coverage Diff @@
## master #370 +/- ##
==========================================
+ Coverage 76.98% 77.24% +0.25%
==========================================
Files 10 11 +1
Lines 817 835 +18
==========================================
+ Hits 629 645 +16
- Misses 188 190 +2
Continue to review full report at Codecov.
|
masterjulia> using Colors
julia> precompile(Tuple{typeof(parse),Type{ColorTypes.Colorant},String})
true
julia> @time parse(Colorant, "#C0FFEE")
0.000055 seconds (12 allocations: 560 bytes)
RGB{N0f8}(0.753,1.0,0.933)
julia> @time parse(Colorant, "#C0FFEE")
0.000008 seconds (11 allocations: 512 bytes)
RGB{N0f8}(0.753,1.0,0.933) What's going on here? Edit: |
This adds some precompile statements to reduce latency. Because the methods are simple to infer, the savings are modest, but combined with precompiles in other packages (FixedPointNumbers, ColorTypes, ColorVectorSpace) I'm getting latency reductions of ~30% for some common operations. So these seem worth having.