Skip to content

Commit a9e778e

Browse files
authored
Add a few precompiles (#181)
1 parent d04bda9 commit a9e778e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/FFTW.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ end
9191
include("fft.jl")
9292
include("dct.jl")
9393

94+
if Base.VERSION >= v"1.4.2" # avoid potential segfaults, see https://github.com/JuliaLang/julia/pull/35378
95+
include("precompile.jl")
96+
_precompile_()
97+
end
98+
9499
end # module

src/precompile.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function _precompile_()
2+
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
3+
for n = 1:3, T in (Float32, Float64, ComplexF32, ComplexF64), D in (UnitRange{Int}, Vector{Int}, Int)
4+
@assert precompile(Tuple{typeof(fft),Array{T,n},D})
5+
@assert precompile(Tuple{typeof(rfft),Array{T,n},D})
6+
@assert precompile(Tuple{typeof(ifft),Array{T,n},D})
7+
@assert precompile(Tuple{typeof(irfft),Array{T,n},Int,D})
8+
@assert precompile(Tuple{typeof(rfft_output_size),Tuple{Int, Int, Int},D})
9+
@assert precompile(Tuple{typeof(rfft_output_size),Tuple{Int, Int},D})
10+
@assert precompile(Tuple{typeof(rfft_output_size),Tuple{Int},D})
11+
end
12+
end

0 commit comments

Comments
 (0)