Skip to content

Long import times #2900

@pb-cdunn

Description

@pb-cdunn

Using import_profiler, I've traced slow imports to networkx, especially:

  • networkx.generators (300ms)
  • networkx.linalg <- .algebraicconnectivity <- numpy (200ms)
  • networkx.readwrite <- .graphml <- xml.etree.cElementTree (100ms)

I'm not using linalg at all, and I rarely need readwrite. I don't think I need generators either. These three trees represent 60% of the import-time for networkx.

When my filesystem is slow, the import-times can be much worse.

I have a couple of ideas for you:

  • If possible, avoid importing these unless they are needed.
  • Or, depend on and use lazy-import for at least these 3 sub-trees.

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