Skip to content

ChainRulesCore dependency causes 4x load time regression #310

@KristofferC

Description

@KristofferC

The quite recent addition of ChainRulesCore (#238) causes a 4x load time regression for this package. This is quite unfortunate since this package is a very common dependency. This has the effect that e.g. complaints are made upstream of slow loading packages (for example JuliaDiff/ForwardDiff.jl#518).

Current master:

julia> @time using SpecialFunctions
  0.256169 seconds (627.68 k allocations: 37.144 MiB, 4.97% gc time, 2.64% compilation time)

Without ChainRulesCore:

julia> @time using SpecialFunctions
  0.053946 seconds (51.40 k allocations: 4.460 MiB, 7.50% compilation time)

There is a bit of irony here in that ForwardDiff (or rather DiffRules) already has derivatives defined for SpecialFunctions (and its tests pass perfectly fine without the ChainRulesCore definitions). Is there any way you could make the people that don't need the (big) ChainRulesCore overhead able to avoid it?

In addition, ChainRulesCore does a bunch of quite exotic stuff (https://github.com/JuliaDiff/ChainRulesCore.jl/blob/63de708a85611f4a65604bec582c71b53d6d5d43/src/ruleset_loading.jl#L84-L126), for example adding hooks that run at every package load (which call into reflection of all things) and it seems unwanted to have such things in such a core dependency as SpecialFunctions.jl is.

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