-
Notifications
You must be signed in to change notification settings - Fork 5
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
Minimize JS/CSS library bundle #10
Comments
Some stats to consider: GoogleChromeLabs/discovery#1 |
Parsing speed on mobile (moto G4) ~1Mb per second. Source: https://youtu.be/Fg7niTmNNLg |
Check optimize-js in addition to minifiers: https://github.com/nolanlawson/optimize-js/blob/master/README.md |
Might contain useful info: https://medium.com/reloading/javascript-start-up-performance-69200f43b201 |
About bundles: different bundles for stuff that change frequently and stuff that doesn't so we can leverage the different caches in place - browsers (less network request time) and JS engines (less time to parse because they maintain a bytecode cache). |
#67 reduced CSS bundle from 70K to 40K. |
#148 reduced the parsed size from 473K to 392K. Before After: |
#155 By removing our custom Gridicon build and use the Gridicons 3 (which allows us to import icons individually) we have reduced the raw/parsed size to 390K (a -2K improvement), and the gzipped to 112K (-1K improvement). |
#174 reduced 10K the raw size and 3K the gzip size by not bundling certain lodash features we're not using. See. Note that Before: After: |
#187 has increased JS (+2K raw) and CSS (+4k raw and 2 new bundles for woo and jpop themes) bundle size. To introduce themes with CSS Custom Properties we need to polyfill for those browsers that yet don't support them. |
The following PRs were merged Add support for npm package #184 #183 #180 #179 #178 #177 #176
|
#243 has reduced bundle size in 70k parsed and 20K gzipped: |
By updating to React 16 in #249 we've reduced happychat.js size in 36K parsed (448K to 412K), and 11K gzipped (127K to 116K): |
Current build size
Run
npm run build:standalone
and note down the sizes of these files intargets/standalone
(note that the bundle analyzer reports a bit more). Thengzip -c file > file.gz
to get the gzipped size.Current bundle distribution (
npm run analyze-bundles
):These are the top-5 components by size:
render
the component tree & tofindDomNode
in some component. Can't be replaced for the managed library, but it wouldn't be necessary for a React/Redux env target (it could be externalized in that case).src/ui
: 67K parsed / 12K gziplodash
: 36K parsed, 10K gzip.src/state
: 31K parsed, 6K gzip.engine.io-client
: 23K parsed, 8K gzip.Some ideas to explore
Resources:
CSS
JS
lodash-webpack-plugin
to drop extras (see). This was done in Update/lodash #174 and reverted in Revert/lodash webpack plugin #182 We ran into too many bugs.The text was updated successfully, but these errors were encountered: