FluxML/Flux.jl

reducing invalidations

Open

#2,080 创建于 2022年10月10日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Julia (4,725 star) (619 fork)batch import
help wanted

描述

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.

贡献者指南