-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compilation & recompilation time to time_imports macro #45064
Add compilation & recompilation time to time_imports macro #45064
Conversation
If you're wondering why julia> @time_imports using OpenSpecFun_jll
29.1 ms ┌ Preferences
39.6 ms ┌ JLLWrappers 23.32% compilation time
47.0 ms OpenSpecFun_jll 31.20% compilation time In another fresh session: julia> @time_imports using Graphics
0.8 ms ┌ NaNMath
31.9 ms ┌ FixedPointNumbers
0.4 ms ┌ Reexport
95.8 ms ┌ ColorTypes 3.41% compilation time
62.4 ms ┌ Colors
210.6 ms Graphics 8.62% compilation time
julia> @time_imports using OpenSpecFun_jll
12.5 ms ┌ Preferences
77.4 ms ┌ JLLWrappers 82.83% compilation time (56% recompilation)
194.9 ms OpenSpecFun_jll 92.46% compilation time (83% recompilation) CC: @timholy. |
Part of the idea for adding the recompilation report is to highlight when the SnoopCompile tooling would be worth getting out. So in that spirit julia> using SnoopCompileCore
julia> invalidations = @snoopr using Graphics
julia> using SnoopCompile
julia> trees = invalidation_trees(invalidations)
3-element Vector{SnoopCompile.MethodInvalidations}:
inserting (::Type{<:FixedPointNumbers.FixedPoint})(x::AbstractChar) in FixedPointNumbers at /home/ian/.julia/packages/FixedPointNumbers/HAGk2/src/FixedPointNumbers.jl:60 invalidated:
backedges: 1: superseding (::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} in Base at char.jl:50 with MethodInstance for (::Type{K} where K<:Char)(::Char) (2 children)
35 mt_cache
inserting reduce_first(::typeof(Base.add_sum), x::FixedPointNumbers.FixedPoint) in FixedPointNumbers at /home/ian/.julia/packages/FixedPointNumbers/HAGk2/src/FixedPointNumbers.jl:295 invalidated:
backedges: 1: superseding reduce_first(::typeof(Base.add_sum), x) in Base at reduce.jl:394 with MethodInstance for Base.reduce_first(::typeof(Base.add_sum), ::Any) (20 children)
inserting convert(::Type{T}, x::ColorTypes.Gray24) where T<:Real in ColorTypes at /home/ian/.julia/packages/ColorTypes/6m8P7/src/conversions.jl:114 invalidated:
backedges: 1: superseding convert(::Type{Union{}}, x) in Base at essentials.jl:280 with MethodInstance for convert(::Core.TypeofBottom, ::Any) (3562 children)
32 mt_cache Edit: Oh, right.. this is what #45051 is trying to fix |
Right, with that PR on top of this one I get
while with this PR only I have
There is left only some recompilation induced in I guess this is a good showcase of the proposed functionality 🙂 |
@time_imports
: add compilation/recompilation time reports
Could the be backported to Julia v1.8?
|
Just run it on nightly? The numbers you get should be fairly the same. |
True, but having it on 1.8 might make package maintainers use it more ... :-) |
(cherry picked from commit 9320fba)
(cherry picked from commit 9320fba)
Adds report to
@time_imports
if any import step included compilation time, and if any of that was recompilation.Observes the nesting, so times stack like the existing import times do.
Worth noting that the overall times reported are similar to
@time
so the overhead seems insignificant