Investigate if/how we could improve `swh` cli command startup time
Currently, usage of the swh
"master" cli tool suffers from pretty slow loading perfs. Seems it's not so lazy. It would be nice to be able to kick a bit its startup time.
In my (venv-based) dev environment, I get:
time swh
Usage: swh [OPTIONS] COMMAND [ARGS]...
Command line interface for Software Heritage.
Options:
-l, --log-level [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL]
Log level (defaults to INFO).
--log-config FILENAME Python yaml logging
configuration file.
--sentry-dsn TEXT DSN of the Sentry instance to
report to
-h, --help Show this message and exit.
Notes:
If both options are present, --log-level will override the
root logger configuration set in --log-config.
The --log-config YAML must conform to the
logging.config.dictConfig schema documented at
https://docs.python.org/3/library/logging.config.html.
Commands:
auth Authenticate Software Heritage users with...
content-replayer Software Heritage Objstorage tools.
dataset Software Heritage Dataset Tools
db Software Heritage database generic tools.
db-init Initialise a database for the Software...
deposit Deposit main command
graph Software Heritage graph tools.
icinga_plugins Main command for Icinga plugins
identify Compute the Software Heritage persistent...
indexer Software Heritage Indexer tools.
lister Software Heritage Lister tools.
loader Loader cli tools
objstorage Software Heritage Objstorage tools.
scanner Software Heritage Scanner tools.
scheduler Software Heritage Scheduler tools.
search Software Heritage Search tools.
storage Software Heritage Storage tools.
vault Software Heritage Vault tools.
real 0m1.694s
user 0m1.766s
sys 0m0.803s
And
PYTHONPROFILEIMPORTTIME=1 swh 2>&1 | grep 'import time:' | wc -l
2622
I'm not convinced we are obliged to import 2k6+ packages to load most swh cli commands.
Migrated from T2575 (view on Phabricator)