Improving perfomance of react-markdown
with very large texts - consider virtualization
#1027
-
I'm working on a tool that converts webpages to markdown. For very large pages, the (rendering?) performance of I.e. render only things that are close to the actual viewport. This would speed things up even for very very large documents. We could render chunks using Not sure if this usecase is extremely rare, and therefore not worth it, though! Any other ideas? edit: rewrote most of the post to make it clear this is about |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Hi @joepio! Improving performance and supporting larger documents is a goal of the community, and is something which is already actively being worked on.
I take your meaning, subtle clarification on terminology.
Right, computers have limited memory and limited CPU, there will always be a page large enough to slow the machine down. No amount of performance optimization will change that.
Thanks for sharing the idea, though it doesn't really fit with remark or micromark for a few reasons.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick and very thorough reply, @ChristianMurphy! I was sent to this discussions board from the I think we can consider
Well, if parsing is only a small fraction of the performance cost, then this will not be a problem for virtualization, since we could only chunk and virtualize the rendering / compiling part. That's a big if, though, we'd need metrics on where the bottlenecks are to make sure virtualization would actually help here. |
Beta Was this translation helpful? Give feedback.
-
This is the only mention I've found of virtualization and react-markdown anywhere on the internet so going to ask this here. Has anyone successfully virtualized a list of items rendering react-markdown? I will say I tried and failed using many virtualization libraries, but maybe someone has an example? Curious if you tried this @joepio. Maybe InteractionObserver is the way? To be clear, this is referring to a a list of div containers, each with react-markdown within them |
Beta Was this translation helpful? Give feedback.
Hi @joepio!
Improving performance and supporting larger documents is a goal of the community, and is something which is already actively being worked on.
@wooorm has been working on refactoring https://github.com/micromark/micromark which is the parser backing remark, to further improve performance.
If you're interested in supporting these efforts consider contributing development resources and/or sponsoring the community https://github.com/sponsors/unifiedjs or https://opencollective.com/unified
I take your meaning, subtle clarification on terminology.
micromark and remark do parsing (text to AST), transforming (AST to AST), and compiling (AST to text).
T…