Investigate ways to further improve CLI start-up and tab completion speed.
My notes on areas we can look at:
(1)
In my OS X example above, we load all modules in ~0.4 seconds but ‘az’ takes ~0.8 seconds.
It takes ~0.4 seconds to load ‘az’ without any modules.
We can investigate improving this.
(2)
The python statement ‘import pkg_resources’ takes about 0.1-0.2 seconds just by itself and it’s used throughout the CLI and in Azure SDKs.
There is an alternative to using this import but since it’s so prolific, it’s not trivial to change.
(3)
The command modules that take more than a few milliseconds to load can be looked at also.
Though typically, these modules just have a lot of commands to contribute to the command table, we can still look into this.
(4)
Importing Profile is slow so we should optimize this and only import it when we really need it.
$ time python -c 'from azure.cli.core._profile import Profile'
real 0m0.446s
user 0m0.364s
sys 0m0.080s
https://github.com/Azure/azure-cli/pull/1364#discussion_r88748237
So much this. It's terribly painful trying to use autocomplete.
Most helpful comment
So much this. It's terribly painful trying to use autocomplete.