While not specific to RV, its really only obvious for programs that load frequently while the user is waiting (like RV). Depending on how you load your packages, reducing your PYTHONPATH is important as well, as this compounds how many synchronous file system stats have to be made.
This is a good optimization to make even for things that aren’t running interactively. Imagine if every job on your farm (especially the “short ones”) saved X seconds of startup time and reduced that kind of impact on your filer.
With RV, you have the added benefit of not all tools getting run on every session. While Python best practices for style often dictate otherwise, burying your lesser used package imports into the places where they are used is one way to decrease waiting time for RV startup, and defer that waiting for only the first time someone uses a tool or function that requires it.
Setting packages to deferred load rather than immediate are useful to. If they are mode-like (like annotations) you can specify a menu and shortcut to activate the mode in the package yaml file. This allows RV to not even touch the python file until it is asked for by the user. If you get super-fancy, the shortcut doesn’t even need to be a hotkey, it can be a custom internal event that another package can call.
Lots of good tricks for getting your load times down, I’d probably start in this order:
- Profile what is taking so long (see my prior post)
- Reduce PYTHONPATH if you have lots of extra locations.
- Reduce or defer imports of costly modules to where they are needed.
- Make any package that can defer load no longer immediate load.