RV Plugin Startup Time

RV startup time can be an important metric for studios. While we recommend using rvpush (if you can) to reduce the impact of RV’s startup time, it is also important to keep your plugin startup time as short as possible.

I have a few tips that have been useful and I wanted to share some (and see if others have things I haven’t mentioned).

  1. Profile First to find your biggest offenders.
    RV has a way of seeing what plugins are loading and how much time they are taking to load. If you run RV with the argument -flags ModeManagerVerbose, you will get a printout of all your packages as they are loaded (or considered in case they aren’t loaded) and a print out of how long it took to load each plugin.
  2. Delay load your expensive imports.
    If you have a tool that is only used occasionally (such as a publish manager or an exporter), delay your import statements so that they only run when needed. Import statements in Python won’t re-run each time you call a duplicate import statement, so if you delay your expensive imports, you can save yourself some start up time and defer those loads to the first time you run the tool.
  3. Reduce your $PYTHONPATH
    Every time you have an import, it searches your $PYTHONPATH. This doesn’t seem too bad, but disk stats can add up, especially if you have network paths. If you have good control over your $PYTHONPATH, try to remove any paths that don’t exist, or are unlikely to have any use for your RV environment.
  4. Consider using delayed load.
    In your PACKAGE file, you can determine the load strategy for your package. The load key for your package has a big effect: Either immediate or delay indicating when the mode should be loaded
    Paired with menu and shortcut keys, you can still have your package accessible and present, but it won’t create your mode until someone uses the menu item or shortcut.
5. Use events to load your delayed load packages.

This is a bit :nerd_face: , but if your package needs to be toggled from code, you can even use a custom event with the event key. Other packages can send that event with sendInternalEvent which can trigger a package to toggle.

If you have a strategy you want to share that I haven’t listed, please feel free to post!

8 Likes