Thanks for the response (and for your work on PrecompileTools
!), what I’m not too keen on, from an aesthetics point of view, is that the PrecompileTools
workflow looks a little out of place in MyModule.jl
, especially when you’re doing a lot of precompilation.
Specifically, everything that comes before PrecompileTools
could (in a Julia world where this were the norm) be written nicely as a .toml
file
Therefore the following:
module MyModule
export MyType funk unfunk
using Funkinator
include("MyType.jl") # MyType
include("funktionality.jl") # funk, unfunk
include("internal_funk.jl")
using PrecompileTools
@compile_workload begin
args = (1, "foo", :bar)
unfunk(funk(args...)
end
end
could be
name = "MyModule"
export = ["MyType", "funk", "unfunk"]
dependencies = ["Funkinator"]
includes = ["MyType.jl", "funktionality.jl", "internal_funk.jl"]
with the PrecompileTools
part could be written something like
workloads = ["unfunk_funk.jl", "apply_funk.jl"]
which makes me think it would be better to write the corresponding part of MyModule
as
using PrecompileTools
include("workloads/unfunk_funk.jl")
include("workloads/apply_funk.jl")
with workloads
being a folder inside src
, and workloads/unfunk_funk.jl
being:
@setup_workload begin
a = 1, 2, 3
b = 'a', 'b', 'c'
# some additional nontrivial setup...
@compile_workload begin
unfunk(funk(a...))
unfunk(funk(b...))
# some additional workload...
end
end
I know there’s nothing stopping me from doing this in my own projects already, but I would like to see others’ thoughts on doing this as there may be something I’m overlooking or a better way of doing this neatly.