Skip to content

[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

Closed

Description

@jsamr

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

image

Basically, using the explicit composite architecture means that all components on top of RenderHtmlSource, starting with TRenderEngineProvider, would be put either at the root of the ReportScreen, 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

Activity

  1. added
    AutoAssignerTriageAuto assign issues for triage to an available triage team member
    on Jul 16, 2021
  2. MelvinBot commented on Jul 16, 2021

    @MelvinBot
    Contributor

    Triggered auto assignment to @NicMendonca (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

  3. removed
    AutoAssignerTriageAuto assign issues for triage to an available triage team member
    on Jul 16, 2021
  4. marcaaron commented on Jul 16, 2021

    @marcaaron
    Contributor

    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?

  5. jsamr commented on Jul 16, 2021

    @jsamr
    ContributorAuthor

    @marcaaron

    is this 32% of 7ms total or per each comment in the chat?

    Per message indeed.

    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?

    It would be my understanding that it would save up 230ms in this scenario; not sure I'm understanding the parallel thing?

    Is there some easy way to tell how much user time this will save once implemented?

    I think your 230ms estimate is reasonable for a 100 messages scenario!

  6. jsamr commented on Jul 16, 2021

    @jsamr
    ContributorAuthor

    PS: I used beta-8 branch for this flamegraph; I previously noticed a bug in alpha-10 (main branch) where RenderHtml was rendered twice. Did not reproduce in beta-8 thus did not bother report 😅

  7. marcaaron commented on Jul 16, 2021

    @marcaaron
    Contributor

    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.

  8. jsamr commented on Jul 26, 2021

    @jsamr
    ContributorAuthor

    @marcaaron I'm ready to have a look into this one this week. Ping me when a Job is ready on Upwork!

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 26, 2021
  10. MelvinBot commented on Jul 26, 2021

    @MelvinBot
    Contributor

    Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

  11. michaelhaxhiu commented on Jul 28, 2021

    @michaelhaxhiu
    Contributor

    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.

  12. 22 remaining items

  13. MelvinBot commented on Aug 9, 2021

    @MelvinBot
    Contributor

    @jsamr, @marcaaron Eep! 4 days overdue now. Issues have feelings too...

  14. marcaaron commented on Aug 10, 2021

    @marcaaron
    Contributor

    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.

  15. added a commit that references this issue on Aug 11, 2021
    1b68a5f
  16. michaelhaxhiu commented on Aug 12, 2021

    @michaelhaxhiu
    Contributor

    @marcaaron should we start the 7 day counter for payment, or is this going to be re-opened for additional related work?

  17. michaelhaxhiu commented on Aug 23, 2021

    @michaelhaxhiu
    Contributor

    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 :)

  18. jsamr commented on Aug 23, 2021

    @jsamr
    ContributorAuthor

    @michaelhaxhiu no worries!

  19. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Aug 25, 2021
  20. changed the title [-][Performance] [Audit]: using react-native-render-html composite architecture could speed up render time of short report actions by 32%[/-] [+][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%[/+] on Aug 25, 2021
  21. added and removed on Aug 30, 2021
  22. changed the title [-][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%[/-] [+][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%[/+] on Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions