FluxML/Flux.jl

reducing invalidations

Open

#2,080 opened on Oct 10, 2022

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Julia (619 forks)batch import
help wanted

Repository metrics

Stars
 (4,725 stars)
PR merge metrics
 (Avg merge 3d 6h) (6 merged PRs in 30d)

Description

using Flux entails a large number of invalidations:

julia> using SnoopCompileCore

julia> @snoopr using Flux
11604-element Vector{Any}:
  MethodInstance for setindex!(::Vector{AbstractString}, ::AbstractString, ::Int64)
 1
  MethodInstance for Base.rehash!(::Dict{Char, AbstractString}, ::Int64)
 2
  MethodInstance for Base.rehash!(::Dict{Char, AbstractString}, ::Int64)
 3
  MethodInstance for sizehint!(::Dict{Char, AbstractString}, ::Int64)
 3
  MethodInstance for Dict{Char, AbstractString}(::Pair{Char, String}, ::Vararg{Pair{Char, String}})
 4
 ⋮
  MethodInstance for Accessors.parse_obj_optics(::Symbol)
 1
  MethodInstance for Base.Broadcast.broadcasted(::Any, ::typeof(Accessors.lower_index), ::Base.RefValue, ::Any, ::Any)
  "jl_method_table_insert"
  MethodInstance for Setfield.parse_obj_lenses(::Any)
 1
  MethodInstance for Base.Broadcast.broadcasted(::Any, ::typeof(Setfield.lower_index), ::Base.RefValue, ::Any, ::Any)
  "jl_method_table_insert"
  broadcasted(f::Flux.Recur, args...) in Flux at /Users/carlo/.julia/packages/Flux/4k0Ls/src/deprecations.jl:20
  "jl_method_table_insert"

Whoever mastered the art of fixing invalidations is welcome to try and reduce them. We should filter out those due to dependencies.

Contributor guide