insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

perf: App start improvement [INS-3957]

Open CurryYangxx opened this issue 1 year ago • 4 comments

close INS-4026 INS-3957 objective: Reduce the App start duration

Changes

Loading strategy

  • [x] use the findBestRoute function to try to return the path with orgId and projectId in:
    • [x] initialEntry
    • [x] organizationId indexLoader
  • [x] sync task: submit action in useEffect instead of syncing in index route loader (organization index & organizationId index)

return deferred value in project loader

This solution is beneficial for both app start and projects change.

  • [x] return deferred data in project loader and wait promise in component

Test

  • [x] user has no cache data
  • [x] user has cache data

CurryYangxx avatar Jun 05 '24 09:06 CurryYangxx

have some console.log for testing now, will be deleted before merge

CurryYangxx avatar Jun 11 '24 03:06 CurryYangxx

can you provide more evidence that this approach is addressing the lionshare of performance impact? from what i can see this PR is doing at least two things. in a perf PR please only focus on a single measurable improvement and give a rationale about why this perf change was chosen in context of other perf impacts which were also investigated.

eg.

thing a 2%
thing b 10%
thing c 88%
i chose c because its was worth optimizing.

jackkav avatar Jun 12 '24 08:06 jackkav

can you provide more evidence that this approach is addressing the lionshare of performance impact? from what i can see this PR is doing at least two things. in a perf PR please only focus on a single measurable improvement and give a rationale about why this perf change was chosen in context of other perf impacts which were also investigated.

eg.

thing a 2%
thing b 10%
thing c 88%
i chose c because its was worth optimizing.

Do you mean the two things is modity initial entry and add async task hooks? This is because if we only modify the initial entry, the logic in the organization and organizationId index route loader will not run, so I put the two changes together to make logic of the app be complete.

CurryYangxx avatar Jun 12 '24 09:06 CurryYangxx

Switching between Organizations also is fast, but there's a split second when it still is not showing all the unsynced collections right after going to another project/organization.

@filfreire Thank you very much for your test.Not showing all the unsynced files right away is as expected, because we return a deferred data in react-router loader and wait the promise in component render phase.

CurryYangxx avatar Jun 25 '24 13:06 CurryYangxx