Skip to content

Using a Pkg extension to reduce package load time caused by StaticArrays #629

Closed
@oschulz

Description

@oschulz

Most of the load time of ForwardDiff is currently due to StaticArrays:

julia> @time_imports import ForwardDiff
      6.8 ms  IrrationalConstants
      0.7 ms  DiffRules
      2.8 ms  StaticArraysCore
      2.1 ms  DiffResults
     17.5 ms  Preferences
      0.2 ms  OpenLibm_jll
      0.3 ms  NaNMath
      2.7 ms  DocStringExtensions 58.56% compilation time
      0.7 ms  Compat
     66.5 ms  ChainRulesCore
      0.5 ms  ChangesOfVariables
      0.8 ms  InverseFunctions
      0.6 ms  LogExpFunctions
      0.2 ms  JLLWrappers
      3.4 ms  CompilerSupportLibraries_jll
      2.6 ms  OpenSpecFun_jll 85.33% compilation time
     15.0 ms  SpecialFunctions
     28.0 ms  MacroTools
      0.2 ms  CommonSubexpressions
    609.2 ms  StaticArrays
    150.9 ms  ForwardDiff

We could use the new Julia v1.9 Pkg weak dependency feature to massively reduce ForwardDiff's load time by creating extensions for StaticArrays (and maybe for ChainRulesCore as well). I had a look, I think StaticArrays is only used in methods that also have StaticArray as an argument type, ForwardDiff doesn't seem to use StaticArrays for internal required functionality.

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