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

build: optimize webpack code split #10831

Merged
merged 1 commit into from
Sep 10, 2020
Merged

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Sep 10, 2020

SUMMARY

Give more hints to webpack code split so that vendor scripts can be better extracted and cached. Reduced the overall bundle size from 7.05MB to 4.11MB.

Future plan would be to utilize more async module imports import(...) so that large chunks of code like brace and mathjs can be loaded on demand instead of on page load.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

Bundle sizes via npm run build -- --analyzeBundle=true:

bundle-before

Visiting an example dashboard ("Tabbed Dashboard" from example testing data) with throttled network:

dashboard-before

After

bundle-after

dashboard-after

There are more JavaScript requests, but DOMContentLoaded time improved. Note this is also only the initial visit. We expect average load time to improve for future new releases as vendor scripts now have better cache.

TEST PLAN

Make sure CI passes.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@ktmud ktmud force-pushed the webpack-bundle-optimize branch from a8275c8 to c17350b Compare September 10, 2020 20:11
@etr2460
Copy link
Member

etr2460 commented Sep 10, 2020

Thanks for the work in this space! Was the main focus here only on dashboards, or do we expect to see more optimal webpack bundling across all pages in the app?

@ktmud
Copy link
Member Author

ktmud commented Sep 10, 2020

Thanks for the work in this space! Was the main focus here only on dashboards, or do we expect to see more optimal webpack bundling across all pages in the app?

I think another low-hanging fruit is to make brace and mathjs async. Make all plugin registry async can also have potential to be impactful.

@kristw
Copy link
Contributor

kristw commented Sep 10, 2020

Yeah mathjs is quite heavy. I wonder if we could switch to something else lighter.

'jquery',
'core-js.*',
'@emotion.*',
'd3.*',
Copy link
Contributor

Choose a reason for hiding this comment

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

this may also pull the one-time-use packages (that are not part of core d3) such as d3-sankey d3-cloud

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll make further tuning in this space in future PRs.

@ktmud ktmud merged commit d80f406 into apache:master Sep 10, 2020
ktmud added a commit that referenced this pull request Sep 15, 2020
Follow up on #10831, move brace and mathjs to async modules so that the initial page load for dashboards most pages can be faster.
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
Follow up on apache#10831, move brace and mathjs to async modules so that the initial page load for dashboards most pages can be faster.
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 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 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants