Skip to content

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Feb 25, 2020

Description

This PR applies tree-shaking to reduce the bundle size of the app. Importing only individual components of FortAwesome icons module reduces the javascript size (chunk-vendors.xxxx.js) significantly, while slightly increasing the css sizes.

This is a table with bundle file size comparisons:

File Previous Size/Current Size Previous Gzipped Size/ Current
dist\js\chunk-vendors.223f9bff.js 1475.01 KiB/ 376.03 KiB 490.67 KiB/ 100.44 KiB
dist\js\app.a1f1e66a.js 110.92 KiB/ 110.66 KiB 31.20 KiB/ 31.21 KiB
dist\css\app.a5bb3cf3.css 302.37 KiB / 542.80 KiB 41.20 KiB/ 66.77 KiB
dist\css\chunk-vendors.8185fa99.css 219.77 KiB/ 302.40 KiB 27.42 KiB/ 41.21 KiB

Checklist:

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository.
  • My commit messages follow best practices.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

…size

Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
@obulat obulat requested a review from akmadian February 25, 2020 08:24
@akmadian
Copy link
Member

I'm curious what the reduction in bundle size was after the commits you've added so far?

@obulat
Copy link
Contributor Author

obulat commented Feb 25, 2020

I'm curious what the reduction in bundle size was after the commits you've added so far?

The whole bundle seems to go from ~2mb to ~1mb. Which still greatly exceeds the limit.

@akmadian
Copy link
Member

akmadian commented Feb 25, 2020

50% reduction is definitely better than nothing. Compressing bitmap images may help shave some more off, but it also might not since Firefox is showing roughly the same file size vs transferred size for images.

Firefox is showing a total of 791kb transferred (Chrome shows about the same). This 791kb is compressed, and once uncompressed, I see a total of 2.26MB. There's probably some bandwidth optimization going on when the site is served from (either) gh pages, or CC's servers. Our current dist bundle is just over 2MB, but a fraction of that is actually being transferred thanks to the magic of compression :)

Capture

@akmadian
Copy link
Member

akmadian commented Feb 26, 2020

I think we're good on bundle size optimization for now. The reduction in zipped size of chunk vendors will go a long way in reducing the amount of transferred data. We could try to optimize further to hit the magical 244KB number, but the site is fast, and loads fast, so I don't think there's much point for now.

I'll make the little syntax change, and rebuild, then merge :)

@akmadian akmadian merged commit 230e52a into master Feb 26, 2020
@akmadian akmadian deleted the reduce-size branch February 26, 2020 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants