Working with a large number of editor instances

I am currently working on implementing a mind map and aiming to utilize ProseMirror to enable rich-text editing for each node. However, this approach would result in the existence of thousands of editor instances simultaneously. EditorState seems to be a lightweight class, but I am unsure about the potential performance implications of having such a large number of instances. Are there any known limitations or best practices for handling a high number of editor instances within ProseMirror?

P.S. Another approach I have considered is using node view to render the mind map. But it seems challenging, and I have a feeling that I may not be able to accomplish it.

A few things to think about as you tackle this problem:

  1. Realistically, what’s the maximum going to be? You might create a benchmark and just test it out. It’s good to think about performance, but is it possible you are thinking about it too early? You should demonstrate need before going down a performance rabbit hole.

  2. Think of it in the form of percentiles: What’s the experience of the average user vs the experience of the top 99.999% user? In my app LegendKeeper, I constantly have to make tradeoffs, as my average user makes maybe 20 things, while my top 10 power users make 20,000 things. At some point I have to say: “Sorry, this article/whiteboard/mindmap won’t work if you add 100,000 things to it, most users are happy with <100.”

  3. Even if a mindmap contains many editable text nodes, do you truly have to render multiple instances of Prosemirror? Mindmaps exist on a canvas, which is interacted with through a viewport; usually objects beyond a canvas’s viewport are culled so they don’t have to be fully instantiated. Or, what if nodes simply display regular HTML content until you hover over them or click an edit button, at which point the node content is replaced with a Prosemirror instance? I think there are several strategies to avoid instantiating many instances of prosemirror.

1 Like

Editor instances should be pretty lightweight, but having thousands might be pushing it. Easy enough to try and measure, though.

1 Like