Mentions légales du service

Skip to content

Speed up CLI in some cases

E. Madison Bray requested to merge embray/refactoring/cli-speedup into master

This moves all the CLI code into a separate sub-package, so that it's possible to load the full CLI interface while importing a minimal number of dependencies.

In particular it takes pain to avoid importing the torch module (by far the most heavy-weight) until and unless it's actually needed by a command.

This also makes some minor improvements to the plugin mechanism in attempt to address the problem I described in this comment. In particular, the built-in dnadna.examples.one_event simulator plugin is only loaded for commands that actually need to use it.

As a result, we have before:

$ time dnadna --help
...
real	0m1.673s
user	0m1.495s
sys	0m0.143s

and after:

$ time dnadna --help
...
real	0m0.450s
user	0m0.410s
sys	0m0.048s

Merge request reports