constellation icon indicating copy to clipboard operation
constellation copied to clipboard

SVG Export Efficiency Enhancements

Open capricornunicorn123 opened this issue 3 months ago • 1 comments

Prerequisites

  • [ ] Reviewed the checklist

  • [ ] Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait for the "CI / Unit Tests") to complete first. Failed Unit tests can be debugged by adding the label "verbose logging" to the GitHub PR.

Description of the Change

This PR introduces enhancements to the SVG Export Plugin to increase the efficiency when exporting large graphs (exceeding 5000 elements). Key enhancements include:

  • Preventing out of view loops for being included in the export.
  • Converting the generation of nodes, connections and blazes into runnable tasks making the export able to execute across multiple threads.
  • Creating a new interface for PluginInteractions whereby multiple tasks running concurrently can update a single PluginInteraction (plugin reporter status bar)
  • Ensuring the view port is translated and rotated in line with the ModelView to ensure that the exported graph does not drift out of frame when exporting from a non Z perspective.
  • Enabled a new export option of linked export which outputs individual png image assets to a separate Image Asset files instead of imbedding them into the svg file, reducing the SVG file size and enabling multiple svg elements to reference ethe same image source file.
  • The final SVG file content is now read from a list of strings representing lines instead of one single large string, enabling SVG file content to exceed the 2 billion character Java String limit that was reached when exporting an embedded export of 20,000 nodes elements.
  • Minor alterations to Thread pools was introduces to allow the creation of a plugin specific thread pool with an appropriate name for enhanced debugging. This functionality is only used in SVGExports currently but could be extended in future.
  • A TestableGraphBuilder was introduced with the intention of automating the building of a Graph object for testing purposes. This eliminates the need to manually build a Graph object for tests. Currently it is limited in the elements and attributes it holds but extension in future may simplify tests (noting this is at the cost of the current isolation of each test case)

Alternate Designs

N/A

Why Should This Be In Core?

It is a core feature enhancement

Benefits

Graphs in the range of 10s of thousands of elements can now be exported in under 60 seconds (on some machines)

Efficiency now scales with machine processing power.

Possible Drawbacks

Increasing the efficiency of the SVG Export plugin has resulted in a reduction in efficiency of the application whilst the plugin is running.

There is an upper limit of elements (+50,000) that cause the Java stack to run out of memory, the root of this error has not yet been determined and is an extreme edge case.

Verification Process

Test exporting from graphs of multiple sizes from multiple perspectives with multiple export options.

Build a Graph

  • Experimental > Build Graph > Sphere Graph Builder

Export to SVG

  • File > Export > to SVG (select Linked or Embedded) (Try exporting with only a few processor or with a lot of processors)

Applicable Issues

#1980

capricornunicorn123 avatar Apr 11 '24 03:04 capricornunicorn123