UnityMarkdownViewer icon indicating copy to clipboard operation
UnityMarkdownViewer copied to clipboard

Performance issues for large documents

Open hybridherbst opened this issue 3 years ago • 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).

hybridherbst avatar Sep 15 '21 07:09 hybridherbst

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 ...

gwaredd avatar Sep 16 '21 17:09 gwaredd

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.

hybridherbst avatar Sep 16 '21 20:09 hybridherbst