question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`import sgkit` takes ~1.5s

See original GitHub issue

For tools using the CLI this amount of delay feels excessive. Around 1s of this time is performing imports. Here’s the import flame graph: (0.1s on xarray.tutorial?!?)

sgkit-import-profile

I assume some of these could be imported only when they are needed - although given that many of the imports are referenced in typing specifications that might not be possible.

I’m not sure yet what the remaining 0.5s is - a cProfile callgraph is pretty useless on import but I think there is a way around that by profiling the individual sgkit files.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
benjefferycommented, Oct 17, 2022

Also see https://github.com/pydata/xarray/issues/6726, seems they are aware of the issue.

0reactions
tomwhitecommented, Oct 24, 2022

Pandas is not used very much in the codebase, so it might be possible to import it lazily.

Similarly, the distance API is pretty niche so making that lazier would be good too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Long import time · Issue #6726 · pydata/xarray - GitHub
Importing the xarray package takes a significant amount of time. For instance: ❯ time python -c "import ... import sgkit takes ~1.5s pystatgen/sgkit#931....
Read more >
sgkit - bytemeta
sgkit repo issues. ... `gwas_tutorial.ipynb` taking too long to run. benjeffery. benjeffery OPEN · Updated 2 days ago · `import sgkit` takes ~1.5s....
Read more >
sgkit - githubmemory
sgkit repo issues. ... `gwas_tutorial.ipynb` taking too long to run. benjeffery. benjeffery OPEN · Updated 2 weeks ago · `import sgkit` takes ~1.5s....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found