Open roflmaostc opened 1 year ago
Add this copied message from slack for a moment:
Here's what I would do:
First, make a "representative workload" for your package. Something that uses the most common latency-sensitive functions. This is probably what you have inside your SnoopPrecompile block?
Put this workload inside a function, then check it's type stable with JET's report_opt . Make type stable as necessary
Check for type piracy. This can be automated using this script here: https://discourse.julialang.org/t/piracy-hunting/90119. Remove all piracy you find
Julia 1.9:
# without precomp
julia> @time @eval begin
using FourierTools; resample(randn((3,3)), (4,4));
end
2.347064 seconds (7.83 M allocations: 521.891 MiB, 7.21% gc time, 71.20% compilation time)
julia> @time @eval begin
using FourierTools
end
0.667420 seconds (1.51 M allocations: 101.459 MiB, 6.05% gc time, 0.93% compilation time)
# with precompile
julia> @time @eval begin
using FourierTools
end
0.896489 seconds (2.05 M allocations: 141.270 MiB, 6.69% gc time, 0.69% compilation time)
julia> @time @eval begin
using FourierTools; resample(randn((3,3)), (4,4));
end
1.032369 seconds (2.35 M allocations: 160.550 MiB, 6.08% gc time, 13.95% compilation time)
4×4 Matrix{Float64}:
1.40546 -1.01361 -0.690086 1.72899
0.0448578 -1.07521 -0.575482 0.544589
0.00392657 -0.224145 1.05394 1.28201
1.36453 -0.162546 0.939333 2.46641
``
Some timings for adding SnoopPrecompile
There is certainly improvement in Time-to-first-X (TTFX) but
using FourierTools
slowed down :/