gwaredd/UnityMarkdownViewer

Performance issues for large documents

Closed this issue · 2 comments

Large documents seem to cause performance issues, e.g. when displaying
https://github.com/needle-mirror/com.unity.render-pipelines.universal/blob/master/CHANGELOG.md
(the Universal Render Pipeline changelog).

It looks like a potential improvement there is that currently no culling happening to the actually visible area (performance gets linearily worse the longer the document is).

That changelog renders instantly for me, although my desktop is quite fast.

Even so, the layout would still need to be run to determine what controls are within the visible area so it's always going to be O(n).

If you know a way to determine which portion of the Editor window was visible it would be easy to cull the blocks in BlockContainer.Draw() but last I checked Unity don't make this available. Things may have changed though ...

If one was to ask Unity they'd probably say "that's why we started UI Toolkit" :D which isn't exactly wrong, it doesn't suffer from the same performance issues.

For me drawing that doc takes ~0.2s which is e.g. prohibitive if you have a single GIF in there as well.