-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move to PrecompileTools . * update disabled precompiles Co-Authored-By: Tim Holy <[email protected]> * fix Co-Authored-By: Tim Holy <[email protected]> --------- Co-authored-by: Tim Holy <[email protected]>
- Loading branch information
1 parent
7c5febd
commit 61ed9cd
Showing
3 changed files
with
30 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
function _precompile_() | ||
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing | ||
# These make a difference for Makie's TTFP and should help others too | ||
# Total time for this to run is ~2s. To time it, disable: | ||
# - the `_precompile_()` call in StaticArrays.jl | ||
# - the jl_generating_output line above | ||
# and then do | ||
# @time StaticArrays._precompile_() | ||
|
||
for T in (Float32, Float64, Int) # some common eltypes | ||
for S = 2:4 # some common sizes | ||
L = S*S | ||
@assert precompile(Tuple{typeof(*),SMatrix{S, S, T, L},SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{typeof(*),SMatrix{S, S, T, L},SVector{S, T}}) | ||
@assert precompile(Tuple{typeof(inv),SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{typeof(transpose),SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{typeof(_adjoint),Size{(S, S)},SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{Core.kwftype(typeof(minimum)),NamedTuple{(:dims,), Tuple{Int}},typeof(minimum),SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{Core.kwftype(typeof(maximum)),NamedTuple{(:dims,), Tuple{Int}},typeof(maximum),SMatrix{S, S, T, L}}) | ||
@assert precompile(Tuple{typeof(getindex),SMatrix{S, S, T, L},SOneTo{S-1},SOneTo{S-1}}) | ||
@setup_workload begin | ||
@compile_workload begin | ||
for T in (Float32, Float64, Int) # some common eltypes | ||
for S = 2:4 # some common sizes | ||
L = S*S | ||
x = fill(0., SMatrix{S, S, T, L}) | ||
x * x | ||
y = fill(0., SVector{S, T}) | ||
x * y | ||
inv(x) | ||
transpose(x) | ||
_adjoint(Size(S, S), x) | ||
minimum(x; dims=1) | ||
minimum(x; dims=2) | ||
maximum(x; dims=1) | ||
maximum(x; dims=2) | ||
getindex(x, SOneTo(S-1), SOneTo(S-1)) | ||
y .* x .* y' | ||
zero(y) | ||
zero(x) | ||
end | ||
end | ||
end | ||
|
||
# TODO: These fail to precompile on v1.11 pre-release | ||
if VERSION < v"1.11.0-0" | ||
# Some expensive generators | ||
@assert precompile(Tuple{typeof(which(__broadcast,(Any,Size,Tuple{Vararg{Size}},Vararg{Any},)).generator.gen),Any,Any,Any,Any,Any,Any}) | ||
@assert precompile(Tuple{typeof(which(_zeros,(Size,Type{<:StaticArray},)).generator.gen),Any,Any,Any,Type,Any}) | ||
@assert precompile(Tuple{typeof(which(_mapfoldl,(Any,Any,Colon,Any,Size,Vararg{StaticArray},)).generator.gen),Any,Any,Any,Any,Any,Any,Any,Any}) | ||
end | ||
# broadcast_getindex | ||
for m = 0:5, n = m:5 | ||
@assert precompile(Tuple{typeof(broadcast_getindex),NTuple{m,Int},Int,CartesianIndex{n}}) | ||
# broadcast_getindex | ||
for m = 0:5, n = m:5 | ||
broadcast_getindex(Tuple(1:m), 1, CartesianIndex(n)) | ||
end | ||
end | ||
end |