Skip to content
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

Invalidations when loading DataFrames #1061

Open
timholy opened this issue Dec 14, 2022 · 0 comments
Open

Invalidations when loading DataFrames #1061

timholy opened this issue Dec 14, 2022 · 0 comments

Comments

@timholy
Copy link
Contributor

timholy commented Dec 14, 2022

Some non-inferrable code in CSV gets invalidated when you load DataFrames. This is a sister issue to JuliaData/DataFrames.jl#3248, and you can read that issue for a more complete discussion of potential ways to address the issue. In CSV's case, the only invalidations you need to care about come from DataStructures; similar to the suggestion in JuliaData/DataFrames.jl#3248, the simplest approach might be to make DataStructures an obligate part of your package. But fixing the inference failure(s) (I haven't tried) would avoid the invalidation without taking on DataStructures as a dependency.

julia> using SnoopCompileCore

julia> invs = @snoopr begin
           using DataFrames
           using CSV
       end;

julia> tinf = @snoopi_deep CSV.File(joinpath(pkgdir(CSV), "test", "testfiles", "precompile.csv"));

julia> using SnoopCompile

julia> tinf
InferenceTimingNode: 7.241082/7.613602 on Core.Compiler.Timings.ROOT() with 15 direct children

julia> trees = invalidation_trees(invs);

julia> staletrees = precompile_blockers(trees, tinf)
1-element Vector{SnoopCompile.StaleTree}:
 inserting iterate(v::Union{Base.KeySet{<:Any, <:DataStructures.SwissDict}, Base.ValueIterator{<:DataStructures.SwissDict}}, state) @ DataStructures ~/.julia/packages/DataStructures/59MD0/src/swiss_dict.jl:646 invalidated:
   mt_backedges: 1: MethodInstance for CSV.Context(::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg, ::CSV.Arg) at depth 1 with 2 children blocked InferenceTimingNode: 0.000292/0.246068 on CSV.File(::String) with 2 direct children
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants