Skip to content
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

perf: Prevent redundant calls to getRelevantDataMask #30883

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Nov 8, 2024

SUMMARY

Move getRelevantDataMask and getAllActiveFilters calls from Dashboard's mapStateToProps to a selector.

On a very large dashboard (300+ charts, 40+ filters) those calls delayed the dashboard loading time by over 3 seconds. After this change, they are negligible. Please keep in mind that you likely won't reproduce that delay on a dashboard from sample data, it only occurs on very large ones.

Sidenote - my key takeaway from this is that we really need to optimize our redux selectors with createSelector from redux toolkit more often. Plenty of our selectors have quite complex code that is mostly running unnecessarily.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before - you can see that there's a 3.2s load event task, which really consists of thousands of getRelevantDataMask calls:

image

image

image

After - 0.8ms:

image

TESTING INSTRUCTIONS

Dashboards with native filters should work just like before

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added the dashboard:performance Related to Dashboard performance label Nov 8, 2024
@kgabryje kgabryje merged commit 57af97d into apache:master Nov 8, 2024
36 checks passed
@sadpandajoe sadpandajoe added the review:checkpoint Last PR reviewed during the daily review standup label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:performance Related to Dashboard performance review:checkpoint Last PR reviewed during the daily review standup size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants