Closed Tortar closed 1 year ago
Merging #829 (7aeea19) into main (6902229) will increase coverage by
0.68%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #829 +/- ##
==========================================
+ Coverage 70.01% 70.70% +0.68%
==========================================
Files 42 43 +1
Lines 2708 2717 +9
==========================================
+ Hits 1896 1921 +25
+ Misses 812 796 -16
Impacted Files | Coverage Δ | |
---|---|---|
src/Agents.jl | 100.00% <ø> (ø) |
|
src/precompile.jl | 100.00% <100.00%> (ø) |
... and 2 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
mmmmhhhh I'm actually not sure that this is as good as it was intended to be since running https://julialang.github.io/PrecompileTools.jl/stable/#Seeing-what-got-precompiled we get e.g.
MethodInstance for Agents.add_agent!(::Agents.UnremovableABM{Agents.ContinuousSpace{2, true, Float64, typeof(Agents.no_vel_update)}, Main.Agents.Models.Bird, Agents.Schedulers.Randomly, Nothing, Random.TaskLocalRNG}, ::Tuple{Float64, Float64}, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64)
which is actually not reusable in other contexts, indeed for not precompiled examples (e.g. predator_prey
) the time is very similar with or without precompilation.
The advantage of fast tutorial examples seems still something to consider, but don't know if worth the (even if little) regression in importing
Yeah it's because practically all functions in Agents.jl dispatch on the Agent type, which is almost certainly different in each application. So pre-compiling is very unlikely to lead to any difference in user developed models...
But thanks a lot for trying this out!
This addresses a comment in https://github.com/JuliaDynamics/Agents.jl/issues/818 .
I think it's a very good improvement in TTFX with little side effects as I will illustrate:
Before pr:
@time using Agents # -> 3.466778
After pr
@time using Agents # -> 3.798331
so there is a little regression, however running this:
before:
after:
So I think a win overall
Precompiling the models in the Models folder makes the examples models almost without latency which is good for users using the library for the first time