Skip to content

A lot of method invalidations coming from InlineStrings #22

@baggepinnen

Description

@baggepinnen

I'm doing some work improving compile times for a number of packages and noticed that InlineStrings keep popping up as a large source of invalidations. I'm not sure how large of a problem this is in practice, but I figured I'll mention it in case you have an easy fix for it

julia> show(trees[end-1])
inserting String(x::T) where T<:InlineStrings.InlineString in InlineStrings at /home/fredrikb/.julia/packages/InlineStrings/aWvyB/src/InlineStrings.jl:114 invalidated:
   backedges: 1: superseding String(s::AbstractString) in Base at strings/string.jl:82 with MethodInstance for String(::AbstractString) (512 children)
   25 mt_cache
false



julia> show(trees[end-2])
inserting string(a::Union{Char, SubString{String}, String}, b::Union{Char, SubString{String}, String}, c::InlineStrings.InlineString) in InlineStrings at /home/fredrikb/.julia/packages/InlineStrings/aWvyB/src/InlineStrings.jl:400 invalidated:
   backedges: 1: superseding string(xs...) in Base at strings/io.jl:185 with MethodInstance for string(::Char, ::Vararg{Any}) (1 children)
              2: superseding string(xs...) in Base at strings/io.jl:185 with MethodInstance for string(::Any, ::Char, ::Any) (9 children)
              3: superseding string(xs...) in Base at strings/io.jl:185 with MethodInstance for string(::Any, ::String, ::Any) (12 children)
              4: superseding string(xs...) in Base at strings/io.jl:185 with MethodInstance for string(::String, ::String, ::Any) (50 children)
              5: superseding string(xs...) in Base at strings/io.jl:185 with MethodInstance for string(::String, ::Vararg{Any}) (360 children)
   3 mt_cache
false

The code I ran to get the data was

using SnoopCompile
invalidations = @snoopr begin
    using ControlSystems
end;

trees = SnoopCompile.invalidation_trees(invalidations);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions