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

fix(sqllab): rendering performance regression #23695

Merged

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Apr 14, 2023

SUMMARY

Alternative solution of #23653

When a schema contains a humorous table list, rendering cost of SqlEditorLeftBar is heavy since it requires to iterate millions items. To avoid the lag of using sql editor, we should avoid the LeftBar rendering while typing.
This commit fixes the useSelector in SqlEditor which triggers the re-rendering of SqlEditorLeftBar anytime redux action triggered.

P.S. - Found the root cause from https://github.com/apache/superset/pull/21320/files#diff-dac1ba995e65dfae7c9aa7a0a794036ace1eb83814e2101d354752da2bb41dfdR166 which is migrated from PureComponent to functional component without shallowEqual which causes the regression

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After (no lag while typing):

after--rendering-perf.mov

Screenshot 2023-04-14 at 11 40 54 AM

Before (typing at same speed):

before--rendering-perf.mov

Screenshot 2023-04-14 at 11 35 32 AM

TESTING INSTRUCTIONS

open sqllab with a list of > 100,000 tables
typing in the sql editor

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

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

expect(SqlEditorLeftBar).toHaveBeenCalledTimes(renderCount);
fireEvent.change(editor, { target: { value: sql } });
// Verify the rendering regression
expect(SqlEditorLeftBar).toHaveBeenCalledTimes(renderCount);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice tests

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinpark justinpark merged commit c197bf9 into apache:master Apr 17, 2023
28 checks passed
justinpark added a commit to airbnb/superset-fork that referenced this pull request Apr 17, 2023
john-bodley pushed a commit to airbnb/superset-fork that referenced this pull request Apr 26, 2023
sebastianliebscher pushed a commit to sebastianliebscher/superset that referenced this pull request Apr 28, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants