-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2021-09-06] [HOLD for payment 2021-09-01] [Performance] [Audit]: using react-native-render-html composite architecture could speed up render time of short report actions by 32% #4123
Comments
Triggered auto assignment to @NicMendonca ( |
32% sounds like a lot but also is this 32% of 7ms total or per each comment in the chat? (I think it must be the latter) Maybe there is a way to dumb this down, but it's hard for me to wrap my head around what this means for the perspective of loading a chat that has something like 50-100 messages. So, let's say we are rendering 100 when the chat loads and there is 730ms of time spent here - that would then become 230ms? Seems pretty significant if it was happening in sequence, but we are also rendering in parallel? Is there some easy way to tell how much user time this will save once implemented? |
Per message indeed.
It would be my understanding that it would save up 230ms in this scenario; not sure I'm understanding the parallel thing?
I think your 230ms estimate is reasonable for a 100 messages scenario! |
PS: I used beta-8 branch for this flamegraph; I previously noticed a bug in alpha-10 (main branch) where |
Got it. I think my question makes no sense because the actual rendering is not happening asynchronously and when we're talking about "rendering time of those composite components" only one can be rendering at a time because JavaScript. |
@marcaaron I'm ready to have a look into this one this week. Ping me when a Job is ready on Upwork! |
Triggered auto assignment to @michaelhaxhiu ( |
I'll work on posting this job to upwork shortly. Let me double check with @puneetlath and @marcaaron a few things and drop a note here after. |
Okie dokie. @jsamr we'd like to add benchmarking to this request to help show the before/after-effects of the enhancement. Do you have any recommendations for that aspect? |
@michaelhaxhiu That's perfectly reasonable. What I propose is to create a separate git repository for benchmarking explicit composite vs implicit composite with the react profiler. What I intend to do is display 100 small distinct HTML snippets in a ScrollView an measure the total render time of this view. What I like with this approach is it's reproducible and transparent. I could also do the profiler measurement within Expensify app. However, I'm not sure how to handle lags caused by Onyx in such case, which might interfere with the results. |
To clarify, are you concerned that lags with Onyx will obscure the benefit? To be honest, a separate benchmark repository doesn't sound as useful to me as measurements done within our app. I may be able to help here. I have a pretty decent manual test that will reveal whether something is improving report render time or not. |
@marcaaron Yes I was a bit worry of that; I'd by happy to see your manual testing strategy; I was also thinking I might sample the render time of each |
It's tedious but effective and I don't have anything better yet but... I build the release native app then time when the
I would maybe do two tests. One where we keep the In my limited experience so far it really seems like |
Job is posted on Upwork. @jsamr feel free to apply and I'll accept you asap - https://www.upwork.com/jobs/~0157cdae32a7b23e69 |
@marcaaron Sorry for my delayed response! NP for the manual testing; I'm ready to tackle this one next week! |
@jsamr is hired for this job in Upwork |
Triggered auto assignment to @marcaaron ( |
This comment has been minimized.
This comment has been minimized.
Removing the |
@jsamr, @marcaaron Eep! 4 days overdue now. Issues have feelings too... |
Just testing out the draft branch now with manual testing. Seems like it's about 20ms faster on average to switch chats with the new branch (so pretty small difference). Unsure if there's some other test we want to do here like the one suggested here. |
@marcaaron should we start the 7 day counter for payment, or is this going to be re-opened for additional related work? |
Going to send payment, as no regressions have been identified. Sorry for the wait @jsamr it's been a busy few weeks on this side :) |
@michaelhaxhiu no worries! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Upwork job link: https://www.upwork.com/jobs/~0157cdae32a7b23e69
This report is part of #3957, scenario "Rendering Individual chat messages".
Flamegraph
Basically, using the explicit composite architecture means that all components on top of
RenderHtmlSource
, starting withTRenderEngineProvider
, would be put either at the root of theReportScreen
, or near the root of the application instead of being replicated for each report action.In the above flamegraph, the rendering time of those composite components is 7.3ms - 5ms = 2.3ms. If those component were factored out, it would mean a net gain of 2.3 / 7.3 = 32%.
Proposal: implement the explicit composite architecture
See https://meliorence.github.io/react-native-render-html/docs/flow/rendering#composite-rendering-architecture
The text was updated successfully, but these errors were encountered: