Skip to content

Commit

Permalink
Merge pull request #21 from JuliaGraphics/teh/ttfp
Browse files Browse the repository at this point in the history
Add a couple of precompiles
  • Loading branch information
yurivish authored Dec 27, 2020
2 parents 84690f3 + 841760f commit 8fe7fa2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/SignedDistanceFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ function downsample(img, xsize, ysize=xsize)
out
end

if Base.VERSION >= v"1.4.2"
include("precompile.jl")
_precompile_()
end

end # module
6 changes: 6 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function _precompile_()
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
@assert precompile(Tuple{typeof(sdf),Matrix{Bool}}) # time: 0.17639625
@assert precompile(Tuple{typeof(edf_sq),Matrix{Bool}}) # in case the above doesn't work
@assert precompile(Tuple{typeof(downsample),Matrix{Float64},Int}) # time: 0.0495947
end

0 comments on commit 8fe7fa2

Please sign in to comment.