Importing GromacsWrapper take seconds. Most of time was wasted in extracting the help for docstrings. Seems that both running the help commands and communicating to acquire the text takes almost 90% of loading times.
This screenshot was taken while profiling the gromacs package importing:
Albeit it is useful, isn't a such important feature and the library keeps running without it. Or maybe we can load it dynamically and make something similar to this:
class GromacsCommand(Command):
@property
def __doc__(self):
if not self.__doc_cache:
# load docstring
return self.__doc_cache
Another option would be to reset GromacsCommand.__doc__ for each subclass. Now we can't simply set Trjconv.__doc__ = "docstring" because Command is an old style class (eg class C(object): pass) which disallow change members of object (ie __doc__). This change would allow it:
Importing GromacsWrapper take seconds. Most of time was wasted in extracting the help for docstrings. Seems that both running the help commands and communicating to acquire the text takes almost 90% of loading times.
This screenshot was taken while profiling the
gromacs
package importing:Albeit it is useful, isn't a such important feature and the library keeps running without it. Or maybe we can load it dynamically and make something similar to this:
Another option would be to reset
GromacsCommand.__doc__
for each subclass. Now we can't simply setTrjconv.__doc__ = "docstring"
becauseCommand
is an old style class (egclass C(object): pass
) which disallow change members ofobject
(ie__doc__
). This change would allow it: