camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.49k stars 479 forks source link

Modeling operations become slow in large diagram #4320

Closed nikku closed 1 month ago

nikku commented 4 months ago

Describe the bug

Working on a large BPMN diagram there is a slowness when completing modeling actions, cf. large-diagram.bpmn.txt.

screenshot POWWfO

Steps to reproduce

  1. Open large-diagram.bpmn.txt
  2. Do any modeling operation
  3. Perceive slowness, editor unresponsive (> 2s of wait time)

Expected behavior

Environment

Additional context

Came up via internal feedback.

nikku commented 4 months ago

TODO

nikku commented 4 months ago

Analysis, executing space tool, time until editor is responsive again:

nikku commented 4 months ago

Work Log

Updated core modeling dependencies to use on board (browser) facilities for critical operations (clear, closest) - https://github.com/bpmn-io/diagram-js/pull/910, https://github.com/bpmn-io/bpmn-js/pull/2182.

Simplifying clear was unfortunately a failed experiment.

nikku commented 4 months ago

Detailed Analysis

Following up on the shallow analysis, here are some more details; using large-diagram.bpmn.txt as a test subject in different environments.

demo.bpmn.io (stock bpmn-js)

image

Desktop Modeler

Uses the minimap which adds a 30% (!) toll on rendering :arrow_right: https://github.com/bpmn-io/diagram-js-minimap/issues/81; linting happens outside of update cycle, not the fastest, but manageable.

image

Web Modeler

Uses the minimap and many custom extensions, resulting in a massive performance blow. The diagram can barely be edited. Kapa.ai integration is responsible for more than 50% of the performance hit, linting everything three times completes the picture :arrow_right: https://github.com/camunda/web-modeler/issues/9606.

image

barmac commented 1 month ago

Done. We can open individual issues.