JuliaGraphs / JuliaGraphs/Graphs.jl

Remove dependence on `StaticArrays`

Open
#244 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
538
Forks
128
Avg merge
10h 25m
Merged PRs (30d)
2

Description

Almost 80% of the time spent loading Graphs.jl is for loading StaticArrays.

Manifest.toml shows that the dependency path is QuantumDAGs $\to$ Graphs $\to$ ArnoldiMethod $\to$ StaticArrays.

ArnoldiMethod is imported into Graphs with using ArnoldiMethod so it's hard to track down where it is used (There is probably an easy way to find which symbols have been imported from a module, but I don't recall.) I tried commenting out using Arnoldi in src/Graphs.jl, but all tests still pass. I did find uses of partialeigen, partialschur, and LM.

I guess that either ArnoldiMethod could be made a weak dependency of Graphs, or StaticArrays could be made a weak dependency of ArnoldiMethod. [EDIT: This is speculation, they could be used internally for performance]

This is breaking unfortunately so it would have to wait for version 2.0. ... OTOH Maybe keeping ArnoldiMethod a hard dependency, but autoloading it would be possible.

 @time @time_imports using Graphs
     12.2 ms  MacroTools
      2.1 ms  SimpleTraits
      2.6 ms  StaticArraysCore
    575.4 ms  StaticArrays
      3.1 ms  ArnoldiMethod
      0.1 ms  Compat
      0.1 ms  Compat → CompatLinearAlgebraExt
      0.5 ms  Inflate
      7.0 ms  OrderedCollections
     67.2 ms  DataStructures
     37.7 ms  Graphs
  0.741944 seconds (1.68 M allocations: 124.559 MiB, 9.88% gc time, 2.79% compilation time)

julia> 575  / 741
0.7759784075573549

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Manifest.toml and src/Graphs.jl, tracing the ArnoldiMethod import and the uses of partialeigen, partialschur, and LM. Use Julia's @time_imports output to measure the loading path, then run the existing test suite while evaluating the dependency or autoloading options. Done means the StaticArrays loading cost is removed or deferred without breaking Graphs functionality or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.