Skip to content

[show] Moving some py imports inside specific show cmds #1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Sabareesh-Kumar-Anandan
Copy link
Contributor

Some py imports are taking more time causing delay in show cmds.
Moved some imports into specific cmds to improve cli exec time.

Signed-off: Sabareesh-Kumar-Anandan [email protected]

- What I did
Some py imports in show/main.py script are taking more time on arm cpus.
modules - pkg_resources, netaddr, portconfig, collections are taking around 800ms causing delay for all show cmds.
These modules are used by only specific cmds. So, I have included these imports only for the commands that are using them.

- How I did it

- How to verify it
Test all show commands. Execution time of show commands is better than before.

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

@lguohan
Copy link
Contributor

lguohan commented Aug 7, 2020

i feel this is the probably the right way to approach the problem. we should split the file into multiple small files and only load corresponding file when needed.

https://click.palletsprojects.com/en/7.x/commands/?highlight=plugin#custom-multi-commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants