Skip to content

Conversation

ranocha
Copy link
Member

@ranocha ranocha commented Sep 25, 2022

I improved type stability to fix some invalidations. This is based on the following code:

julia> import Pkg; Pkg.activate(temp=true); Pkg.add("HTTP")

julia> using SnoopCompileCore; invalidations = @snoopr(using HTTP); using SnoopCompile

julia> length(uinvalidated(invalidations))
752

julia> trees = invalidation_trees(invalidations)
...
inserting write(ctx::MbedTLS.MD, buf::Vector{UInt8}) in MbedTLS at ~/.julia/packages/MbedTLS/yELM7/src/md.jl:138 invalidated:
...
                 20: signature Tuple{typeof(write), Any, Vector{UInt8}} triggered MethodInstance for Logging.var"#handle_message#3"(::Base.Pairs{Symbol, _A, Tuple{Symbol}, NamedTuple{names, T}} where {_A, names, T<:Tuple{Vararg{Any, N}}}, ::typeof(Base.CoreLogging.handle_message), ::Logging.ConsoleLogger, ::Base.CoreLogging.LogLevel, ::LazyString, ::Module, ::Symbol, ::Symbol, ::String, ::Int64) (3 children)
                 21: signature Tuple{typeof(write), Any, Vector{UInt8}} triggered MethodInstance for Logging.var"#handle_message#3"(::Base.Pairs{Symbol, _A, Tuple{Symbol}, NamedTuple{names, T}} where {_A, names, T<:Tuple{Vararg{Any, N}}}, ::typeof(Base.CoreLogging.handle_message), ::Logging.ConsoleLogger, ::Base.CoreLogging.LogLevel, ::String, ::Module, ::Symbol, ::Symbol, ::String, ::Int64) (3 children)
                 22: signature Tuple{typeof(write), Any, Vector{UInt8}} triggered MethodInstance for Logging.var"#handle_message#3"(::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}}, ::typeof(Base.CoreLogging.handle_message), ::Logging.ConsoleLogger, ::Base.CoreLogging.LogLevel, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) (29 children)
                 23: signature Tuple{typeof(write), Any, Vector{UInt8}} triggered MethodInstance for Base.CoreLogging.var"#handle_message#2"(::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}}, ::typeof(Base.CoreLogging.handle_message), ::Base.CoreLogging.SimpleLogger, ::Base.CoreLogging.LogLevel, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) (123 children)
                 24: signature Tuple{typeof(write), Any, Vector{UInt8}} triggered MethodInstance for Base.CoreLogging.var"#handle_message#2"(::Base.Pairs{Symbol, _A, Tuple{Symbol}, NamedTuple{names, T}} where {_A, names, T<:Tuple{Vararg{Any, N}}}, ::typeof(Base.CoreLogging.handle_message), ::Base.CoreLogging.SimpleLogger, ::Base.CoreLogging.LogLevel, ::LazyString, ::Module, ::Symbol, ::Symbol, ::String, ::Int64) (1106 children)

With this PR on top of the current release-1.8 branch:

julia> length(uinvalidated(invalidations))
22

julia> trees = invalidation_trees(invalidations)
2-element Vector{SnoopCompile.MethodInvalidations}:
 inserting joinpath(uri::URIs.URI, parts::String...) in URIs at ~/.julia/packages/URIs/JmxRD/src/URIs.jl:554 invalidated:
   mt_backedges: 1: signature Tuple{typeof(joinpath), Any, String} triggered MethodInstance for Artifacts.jointail(::Any, ::String) (1 children)
   6 mt_cache

 inserting write(bio::OpenSSL.BIO, out_data) in OpenSSL at ~/.julia/packages/OpenSSL/flREB/src/OpenSSL.jl:1544 invalidated:
   mt_backedges: 1: signature Tuple{typeof(write), Any, String} triggered MethodInstance for Base.create_expr_cache(::Base.PkgId, ::String, ::String, ::Vector{Pair{Base.PkgId, UInt64}}, ::IOBuffer, ::Base.DevNull) (1 children)
                 2: signature Tuple{typeof(write), Any, String} triggered MethodInstance for Base.create_expr_cache(::Base.PkgId, ::String, ::String, ::Vector{Pair{Base.PkgId, UInt64}}, ::IO, ::IO) (21 children)
   9 mt_cache

CC @quinnj

@ranocha ranocha added latency Latency backport 1.8 Change should be backported to release-1.8 labels Sep 25, 2022
@DilumAluthge DilumAluthge force-pushed the hr/invalidations_mbedtls branch from fcf1efb to b507e4a Compare September 26, 2022 14:30
end
buf = IOBuffer()
stream = logger.stream
stream::IO = logger.stream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.stream is declared as IO-field -- so best to annotate L676 as stream = stderr::IO, but it's no longer necessary for v1.9.

@aviatesk aviatesk merged commit 6c0aa6d into JuliaLang:master Sep 27, 2022
@ranocha ranocha deleted the hr/invalidations_mbedtls branch September 27, 2022 11:25
KristofferC pushed a commit that referenced this pull request Sep 30, 2022
@KristofferC KristofferC mentioned this pull request Sep 30, 2022
37 tasks
KristofferC pushed a commit that referenced this pull request Oct 28, 2022
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latency Latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants