openworm / owmeta-core

Core library for owmeta
MIT License
3 stars 2 forks source link

Cache sub-commands and hints to avoid pkg_resources load #34

Open mwatts15 opened 2 years ago

mwatts15 commented 2 years ago

The pkg_resources module import load takes a long time (~100ms on my machine) in CLI startup. It would be preferable not to import pkg_resources for every cli execution to avoid the cost of importing pkg_resources. This also means not calling iter_entry_points for every cli execution, so we need to cache the results of iter_entry_points execution as well: either the entry point names or the results of loading the entry points. For the sake of speed, it's acceptable to require an extra step to update the cache for new installs after first running a newly-installed owm, however the first run of owm should not require any extra steps other than the normal install procedures to run successfully with all sub-commands and hits available.