Skip to content

Commit ad47f3d

Browse files
committed
precompile common function calls
1 parent b8740b5 commit ad47f3d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1616
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
1717
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1818
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
19+
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1920
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2021
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2122

@@ -34,6 +35,7 @@ FastTransforms = "0.12, 0.13, 0.14"
3435
FillArrays = "0.11, 0.12, 0.13"
3536
IntervalSets = "0.5, 0.6, 0.7"
3637
Reexport = "0.2, 1"
38+
SnoopPrecompile = "1"
3739
SpecialFunctions = "0.10, 1.0, 2"
3840
julia = "1.6"
3941

src/ApproxFunOrthogonalPolynomials.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,6 @@ include("roots.jl")
109109
include("specialfunctions.jl")
110110
include("fastops.jl")
111111
include("show.jl")
112+
include("precompile.jl")
112113

113114
end

src/precompile.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using SnoopPrecompile
2+
3+
@precompile_setup begin
4+
splist = Any[Jacobi(1, 1), Chebyshev(), Ultraspherical(1)]
5+
append!(splist, Any[Jacobi(1, 1, 0..1), Chebyshev(0..1), Ultraspherical(1, 0..1)])
6+
push!(splist, Chebyshev(Segment(1.0+im,2.0+2im)))
7+
a = Fun(ChebyshevInterval{BigFloat}(),BigFloat[1,2,3])
8+
@precompile_all_calls begin
9+
for S in splist
10+
v = [0.0, 1.0]
11+
f = Fun(S,v)
12+
abs(DefiniteIntegral()*f - sum(f))
13+
norm(Derivative()*f-f')
14+
norm(differentiate(integrate(f)) - f)
15+
norm(differentiate(cumsum(f))-f)
16+
norm(first(cumsum(f)))
17+
end
18+
Fun(sin,Interval(big"0.0", big"1.0")
19+
end
20+
end

0 commit comments

Comments
 (0)