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

[core] Update babel-plugin-optimize-clsx #15894

Merged
merged 1 commit into from May 28, 2019
Merged

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented May 27, 2019

Has some new features and bug fixes so it generates even faster and smaller code

Output from yarn workspace @material-ui/core build:

// No plugin
Computed sizes of "build/umd/material-ui.production.min.js" with "umd" format
  bundler parsing size: 845,370 B
  browser parsing size (minified with terser): 296,705 B
  download size (minified and gzipped): 84,586 B

// 1.1.2
Computed sizes of "build/umd/material-ui.production.min.js" with "umd" format
  bundler parsing size: 837,672 B
  browser parsing size (minified with terser): 294,841 B
  download size (minified and gzipped): 83,987 B

// 2.1.0
Computed sizes of "build/umd/material-ui.production.min.js" with "umd" format
  bundler parsing size: 837,380 B
  browser parsing size (minified with terser): 294,670 B
  download size (minified and gzipped): 83,953 B

@mui-pr-bot
Copy link

Details of bundle changes.

Comparing: 8cfaa98...da95e85

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core -0.05% -0.05% 315,924 315,753 86,498 86,457
@material-ui/core/Paper 0.00% +0.01% 🔺 67,923 67,923 20,182 20,185
@material-ui/core/Paper.esm 0.00% 0.00% 61,205 61,205 18,969 18,969
@material-ui/core/Popper 0.00% 0.00% 28,740 28,740 10,346 10,346
@material-ui/core/Textarea 0.00% 0.00% 5,513 5,513 2,376 2,376
@material-ui/core/TrapFocus 0.00% 0.00% 3,744 3,744 1,575 1,575
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 15,960 15,960 5,781 5,781
@material-ui/core/useMediaQuery 0.00% 0.00% 2,106 2,106 975 975
@material-ui/lab -0.01% +0.02% 🔺 138,861 138,853 42,642 42,649
@material-ui/styles 0.00% 0.00% 51,406 51,406 15,199 15,199
@material-ui/system 0.00% 0.00% 14,458 14,458 4,181 4,181
Button +0.02% 🔺 -0.01% 83,869 83,889 25,459 25,456
Modal 0.00% 0.00% 20,344 20,344 6,681 6,681
colorManipulator 0.00% 0.00% 3,904 3,904 1,543 1,543
docs.landing 0.00% 0.00% 55,992 55,992 14,065 14,065
docs.main 0.00% +0.01% 🔺 645,772 645,779 203,183 203,195
packages/material-ui/build/umd/material-ui.production.min.js -0.06% -0.04% 294,841 294,670 83,987 83,953

Generated by 🚫 dangerJS against da95e85

@eps1lon eps1lon added the core label May 27, 2019
@oliviertassinari
Copy link
Member

@merceyz Nice work! How did you manage to further reduce the bundle size output?

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Good stuff.

Unrelated: Would really like to see how brotli compares to gzip. Not sure how widespread brotli usage is though. I only know that netlify doesn't support it (yet).

@merceyz
Copy link
Member Author

merceyz commented May 27, 2019

Nice work! How did you manage to further reduce the bundle size output?

@oliviertassinari https://github.com/merceyz/babel-plugin-optimize-clsx/blob/master/CHANGELOG.md
The things that apply in this project are:

  • Size and performance:
    • add support for creating conditional expressions
    • use proptypes to minimize expressions
  • Performance (and -2 characters at each location it happened):
    • don't create an arrayExpression with just one item

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Using the prop types is as smart as frightening (I'm exagerating), I'm glad we run the Babel plugin systemically, for all our tests.

@merceyz
Copy link
Member Author

merceyz commented May 27, 2019

Using the prop types is as smart as frightening (I'm exagerating)

@oliviertassinari Thank you ^^, you can see what it does with them here: https://github.com/merceyz/babel-plugin-optimize-clsx/tree/master/test/fixtures/proptypes

@eps1lon eps1lon merged commit f4bd455 into mui:master May 28, 2019
@merceyz merceyz deleted the update-plugin branch May 28, 2019 15:08
@zannager zannager added the core Infrastructure work going on behind the scenes label Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants