useblocks / sphinx-needs

Adds needs/requirements to sphinx
https://sphinx-needs.readthedocs.io/en/latest/index.html
MIT License
207 stars 65 forks source link

Performance improvement: Replace plantuml for needflow #1218

Closed arwedus closed 2 weeks ago

arwedus commented 4 weeks ago

Problem description

In our project with ~700 needflow diagrams, calling plantuml has quite a big performance overhead. Even with plantuml_batch_size set to large values (e.g. 256), we still noticed in performance measurements that sphinx-build with sphinx-needs spends a lot of time waiting for spawned java processes. We also noticed that plantuml spwans one java process per sphinx writer process, resulting in the batch size not being fully used. Also, plantuml is simply slow.

Solution idea

As already mentioned by @chrisjsewell , plantuml is itself using graphviz, and the needflow diagrams have little plantuml specific configuration features, so instead of generating plantUML code, sphinx-needs could also directly generate graphviz code and invoke graphviz for needflow diagram generation instead.

The behavior to use graphviz instead of plantuml for needflow diagrams could be made configurable by a configuration option, or be set as new default in the next sphinx-needs major version.

chrisjsewell commented 4 weeks ago

Heya yeh as I've mentioned previously, I think in principle this is possible (without having actually tried it yet).

One complication to mention, is config like https://sphinx-needs.readthedocs.io/en/latest/configuration.html#needs-flow-configs, which are essentially "hard-coded" to platuml syntax. Ideally, this would be made more "generic", so that it could be applied for any "graphing backend"

chrisjsewell commented 2 weeks ago

fixed in #1235