-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precompile methods for common types (#148)
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Manifest.toml |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ os: | |
- osx | ||
julia: | ||
- 1.0 | ||
- 1.1 | ||
- 1.2 | ||
- nightly | ||
notifications: | ||
email: false | ||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function _precompile_() | ||
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing | ||
normedtypes = (N0f8, N0f16) # precompiled Normed types | ||
realtypes = (Float16, Float32, Float64, Int) # types for mixed Normed/Real operations | ||
for T in normedtypes | ||
for f in (+, -, abs, eps, rand) # unary operations | ||
@assert precompile(Tuple{typeof(f),T}) | ||
end | ||
@assert precompile(Tuple{typeof(rand),T,Tuple{Int}}) | ||
@assert precompile(Tuple{typeof(rand),T,Tuple{Int,Int}}) | ||
for f in (trunc, floor, ceil, round) # rounding operations | ||
@assert precompile(Tuple{typeof(f),T}) | ||
@assert precompile(Tuple{typeof(f),Type{Int},T}) | ||
end | ||
for f in (+, -, *, /, <, <=, ==) # binary operations | ||
@assert precompile(Tuple{typeof(f),T,T}) | ||
for S in realtypes | ||
@assert precompile(Tuple{typeof(f),T,S}) | ||
@assert precompile(Tuple{typeof(f),S,T}) | ||
end | ||
end | ||
# conversions | ||
for S in realtypes | ||
@assert precompile(Tuple{Type{T},S}) | ||
@assert precompile(Tuple{Type{S},T}) | ||
@assert precompile(Tuple{typeof(convert),Type{T},S}) | ||
@assert precompile(Tuple{typeof(convert),Type{S},T}) | ||
end | ||
end | ||
end |