Skip to content

markdown-react significantly affects rendering. #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benloh opened this issue Sep 9, 2020 · 6 comments
Closed

markdown-react significantly affects rendering. #139

benloh opened this issue Sep 9, 2020 · 6 comments

Comments

@benloh
Copy link
Collaborator

benloh commented Sep 9, 2020

Using Low-end mobile emulation to throttle network and CPU, rending a 499 node NodeTable (H213FA2020Prokopios) takes about 14 seconds. Of those 14 seconds, 8.5 seconds is eaten up by the markdown-react component.

Removing it, or disabling it, or otherwise figuring out how to use it judiciously would significantly improve performance.

@jdanish
Copy link
Collaborator

jdanish commented Sep 9, 2020

Is there a way to flag a node as including markdown or not and then only pass it through the renderer if it has actual markdown? I believe it currently only re-renders those nodes if they are edited so it should only be the initial rendering that is slowed by the markdown component, right? Otherwise maybe putting an "include markdown" flag in the template is a good short-term solution since I like it for my small graphs but we might turn it off for these massive ones.

@benloh
Copy link
Collaborator Author

benloh commented Sep 9, 2020

I'm not sure how we would detect if there's markdown...

The fact that this is being called so much suggests there is some other inefficiency at work.

Sounds like we need to invest the time on this one.

@benloh
Copy link
Collaborator Author

benloh commented Sep 9, 2020

Testing...Commenting out the markdown component reduces rendering time on low-end mobile from 14s down to 4.5s.

@kalanicraig
Copy link
Collaborator

kalanicraig commented Sep 9, 2020 via email

@jdanish
Copy link
Collaborator

jdanish commented Sep 9, 2020

I'm OK with the flag as a short-term solution as I like to use markdown in my smaller graphs like the CHAT one and yet I don't see it being used really in the larger graphs.

As for something more nuanced ... worst case, I'd think that when a node or edge gets saved, it can compare the returned markdown with the original text. If they differ, it can flip a flag to indicated "required MD" and if it is identical, then the opposite. If we save that with the nodes (including in the DB) then once one client has checked whether a node needs rendering, no one else will need to, and then only rendered nodes will require passing through the renderer. Of course, if every node detail of all 500 has MD it will still be slowed down, but at that point, I think that's OK. Just a thought - I am sure it is a bit more complicated than that.

@benloh
Copy link
Collaborator Author

benloh commented Sep 9, 2020

59ccae1 improves performance by:

  1. Removing Markdown component to a separate class
  2. Only displaying the Markdown component if there is text.

Performance with "Low-end mobile" is now similar to performance without Markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants