Skip to content

BAT dependencies, package load time(s) and modularization #351

Description

@oschulz

This issue is intended to keep track of modularizing (splitting up) BAT to reduce package load time(s) and increase flexibility.

The current high load time of BAT is mainly due to it's dependencies. Dependency optiions and load-time cost, preliminary analysis:

Unavoidable expensive core deps:

  • Distributions (includes StatsBase)
  • StaticArrays (indirect through many packages)

Unavoidable non-negligible deps:

  • ArraysOfArrays
  • ValueShapes
  • RecipesBase
  • Possibly some ArrayInterface packages (ArrayInterfaceCore is now very lightweight)

Hard-to-avoid non-negligible direct/indirect deps

  • BangBang
  • Transducers (non-negligible cost on top of BangBang)
  • TerminalLoggers
  • PrettyTables (may be avoidable)
  • DataStructures

Cheap deps:

  • StructArrays: Very cheap on top of StaticArrays
  • AbstractDifferentiation: Almost free on top of ChainRulesCore

Autodiff choices:

  • ForwardDiff: Quite cheap on top of StaticArrays and Distributions
  • FiniteDifferences: Basically free on top of StaticArrays and Distributions
  • FiniteDiff: Instead of FiniteDifferences, would pull in ArrayInterface
  • Zygote: Expensive
  • (Future option) Diffractor: Quite cheap on top of StaticArrays

Math deps:

  • LinearMaps: About 100 ms, no deps

Statistics deps:

  • LogarithmicNumbers: Very cheap on top of unavoidable deps
  • MeasureBase: Not that expensive on top of unavoidable deps (uses LogarithmicNumbers)

Optimizer deps:

  • NLSolversBase: Cheap itself, but depends on ArrayInterface, ChainRulesCore, SpecialFunctions and ForwardDiff
  • Optim: Cheap itself, but pulls in ForwardDiff and ArrayInterface via FiniteDiff,
    BAT would need only Nelder-Mead and L-BFGS for core functionality though
  • LBFGSB: Cheap, but indroduces binary deps
  • Manopt: Would be chop on top of StaticArrays if it didn't pull in ColorSchemes

Sampler deps:

  • AbstractMCMC: Cheap on top of StaticArrays, Distributions, Transducers, TerminalLoggers
  • AdvancedHMC: Quite cheap on top of AbstractMCMC
  • PSIS: Cheap on top of unavoidable deps

Integator deps:

  • CUBA: Cheap, but indroduces binary deps
  • MonteCarloIntegration: Almost free on top of unavoidable deps
  • HCubature: Almost free on top of unavoidable deps
  • QuadGK: Cheap, but only univariate

Deps to avoid:

  • Folds: Significant load time cost on top of Transducers
  • SciMLBase: Really expensive
  • GalacticOptim: Not cheap even on top of SciMLBase, also load-time interplay with SciMLBase
  • Optimization: Over 1000 ms load time on top of it's heavy deps (Optim, GPUArrays, RecursiveArrayTools, SciMLBase)

Expensive deps to get rid of:

  • DoubleFloats
  • Polynomials
  • ... ?

Non-negligible deps to get rid of:

  • KernelDensity
  • PrettyTables (maybe, see above)
  • AdaptiveRejectionSampling (cost due to ForwardDiff though)
  • ... ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions