ParaView plugin delayed load

Some ParaView plugin contains a great number of filters and thus contains a lot of symbols.
One such plugin is the TTK plugin.

Loading many symbols can take some time, and when a plugin is set to autoload, ParaView user must wait this time everytime they start ParaView.

This time cost could be mitigated if we loaded the plugin only when needed, only when a proxy provided by a plugin is instanciated.
Thankfully, ParaView is already able to load a only proxies as a plugin, through the “XMLOnly” plugins logic.
It would then be realist to load first only the XML part of a plugin and load dynamically the actual plugin whenever needed.
Of course, Client side part of plugin (Toolbar, Dockwidget) would not be available until the plugin is fully loaded.

A first idea would be to add dedicated XML tag for that in the ServerManager .xml of a plugin, but there is a clear problem.
Generally, big plugin have multiple or even dozen of .xml files. Individually loading each of these file to access each proxy could be problematic.

So here is a suggestion.

ParaView could support to load plugin XML config file, like these:

<?xml version="1.0"?>
<Plugins>
  <Plugin name="AcceleratedAlgorithms" auto_load="0" />
  <Plugin name="AnalyzeNIfTIReaderWriter" auto_load="0" />
  <Plugin name="ArrowGlyph" auto_load="0" />
  <Plugin name="BagPlotViewsAndFilters" auto_load="0" />
  <Plugin name="BivariateRepresentations" auto_load="0" />
<Plugins>

This syntax is used internally by ParaView and it is also used with a slightly different variant in the contact of the PV_PLUGIN_CONFIG_FILE (ParaView: Plugin Howto):

<?xml version="1.0"?>
<Plugins>
  <Plugin name="MyPlugin" filename="/absolute/path/to/libMyPlugin.so"/>
  <Plugin name="MyPluginRel" filename="relative/path/to/libMyPlugin.so"/>
</Plugins>

Indeed, we could augment this syntax as follows for internal plugins:

<?xml version="1.0"?>
<Plugins>
  <Plugin name="AcceleratedAlgorithms" auto_load="1" delayed_load="1">
    <XML filename="AcceleratedAlgorithms_A.xml"/>
    <XML filename="AcceleratedAlgorithms_B.xml"/>
  </Plugin>
  <Plugin name="AnalyzeNIfTIReaderWriter" auto_load="0" />
<Plugins>

And as follows for external plugins:

<?xml version="1.0"?>
<Plugins>
  <Plugin name="MyPlugin" filename="relative/path/to/libMyPlugin.so" auto_load=1 delayed_load=1>
    <XML filename="relative/path/to/MyPlugin_A.xml"/>
    <XML filename="relative/path/to/MyPlugin_A.xml"/>
  </Plugin>
  <Plugin name="MyPluginRel" filename="relative/path/to/libMyPlugin.so"/>
</Plugins>

Of course it would require some kind of automation to generate such files as well as the installation of the .xml files in the install tree of ParaView and of external plugins.

Another thing to consider is that until the plugin is fully loaded, there are many information missing, especially the description of the plugin.

In this context, being able to display somewhere the proxies provided by a plugin would be benificial.
Not only it would be a great feature for all plugin, it would be information the XML plugin and delated load plugin would provide easily.

Let me know what you think.

1 Like

Something that came to mind after wiriting this is that some user may want to be able load such file from the UI of ParaView so that it can be stored in the settings, as plugin already are.

A dedicated button will need to be added “Load plugin config file” in order to do that.

I currently have a functionnal protoype supporting the syntax described above (which I just fixed by editing the post).

However, due to the way ParaView is architectured, I had to add a dedicated XML tag in the proxies declaration, somthing like:

 <EnsureProxy name="PluginName"/>

Of course, this XML tag will be automatically added when loading a delayed_load plugin config file, but could actually be used by anyone to ensure a plugin is loaded when creating a proxy, which is a O(n) operation where n is the number of plugins.

Draft MR: https://gitlab.kitware.com/paraview/paraview/-/merge_requests/6667

We are moving forward with this implementation

1 Like