Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ version = "0.1.4"

[deps]
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"

[compat]
FunctionWrappers = "1"
PrecompileTools = "1"
TruncatedStacktraces = "1"
julia = "1.6"

Expand Down
32 changes: 32 additions & 0 deletions src/FunctionWrappersWrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,36 @@ function wrapped_return_types(fww::FunctionWrappersWrapper)
map(fw -> typeof(fw).parameters[1], fww.fw)
end

using PrecompileTools

@setup_workload begin
@compile_workload begin
# Precompile common use cases with Float64 and Int types
# These are the most common type combinations for numerical computations

# Binary operation with multiple type combinations (common pattern)
fw_binary = FunctionWrappersWrapper(
+,
(Tuple{Float64, Float64}, Tuple{Int, Int}),
(Float64, Int)
)
fw_binary(1.0, 2.0)
fw_binary(1, 2)

# Unary operation with multiple types (common pattern)
fw_unary = FunctionWrappersWrapper(
abs,
(Tuple{Float64}, Tuple{Int}),
(Float64, Int)
)
fw_unary(1.0)
fw_unary(1)

# Precompile introspection functions
unwrap(fw_unary)
wrapped_signatures(fw_binary)
wrapped_return_types(fw_binary)
end
end

end
Loading