microsoft / microsoft/Qcodes

qcodes import takes a long time

Open
#4,543 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

Importing qcodes with `import qcodes` takes a long time (> 2 seconds on the system tested). The import time can be analysed with tools like https://github.com/asottile/importtime-waterfall

Several components could perhaps not be loaded by default, or with a lazy loader (e.g. https://scientific-python.org/specs/spec-0001/, but there are more tools)

An example is the import `from opencensus.ext.azure.log_exporter import AzureLogHandler` from `qcodes.logger.logger`. By default `qc.config.telemetry.enabled` is False, so the import is executed at startup, but not used.

(more examples can be found by analysing the output of importtime-waterfall)

Contributor guide

Open the contributing guide

Research direction

Start by profiling `import qcodes` with importtime-waterfall, then inspect the `AzureLogHandler` import in `qcodes.logger.logger` and other costly imports identified by the profile. Done means reducing startup import time by deferring components that are not needed by default, while preserving behavior when those components are used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.