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

Reduce some constant duplication #20761

Merged
merged 2 commits into from
Feb 8, 2021
Merged

Reduce some constant duplication #20761

merged 2 commits into from
Feb 8, 2021

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Feb 8, 2021

Let's see if this lets us reclaim some of the byte increase from #20760.

The idea is that for an overwhelming majority of events, the DOM name is just the lowercase version of the React name without the on before it. We already do some string acrobatics to get the React name, so why not reuse them and remove the repetition of almost the same term. This was a bit harder to do before because this list was also used for priorities, but it's not anymore. I hardcoded the exceptions.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 8, 2021
@sizebot
Copy link

sizebot commented Feb 8, 2021

Comparing: 77754ae...40b3ae4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 123.20 kB 122.41 kB = 39.62 kB 39.46 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.78 kB 128.99 kB = 41.66 kB 41.49 kB
facebook-www/ReactDOM-prod.classic.js = 407.36 kB 406.03 kB = 75.38 kB 75.21 kB
facebook-www/ReactDOM-prod.modern.js = 395.71 kB 394.37 kB = 73.55 kB 73.39 kB
facebook-www/ReactDOMForked-prod.classic.js = 407.37 kB 406.04 kB = 75.38 kB 75.22 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactDOMForked-profiling.classic.js = 426.25 kB 424.92 kB = 78.67 kB 78.51 kB
facebook-www/ReactDOM-profiling.classic.js = 426.24 kB 424.91 kB = 78.67 kB 78.50 kB
facebook-www/ReactDOMForked-profiling.modern.js = 414.55 kB 413.22 kB = 76.82 kB 76.66 kB
facebook-www/ReactDOM-profiling.modern.js = 414.54 kB 413.21 kB = 76.82 kB 76.65 kB
facebook-www/ReactDOMForked-prod.classic.js = 407.37 kB 406.04 kB = 75.38 kB 75.22 kB
facebook-www/ReactDOM-prod.classic.js = 407.36 kB 406.03 kB = 75.38 kB 75.21 kB
facebook-www/ReactDOMTesting-prod.classic.js = 402.12 kB 400.79 kB = 75.75 kB 75.58 kB
facebook-www/ReactDOMForked-prod.modern.js = 395.72 kB 394.38 kB = 73.56 kB 73.40 kB
facebook-www/ReactDOM-prod.modern.js = 395.71 kB 394.37 kB = 73.55 kB 73.39 kB
facebook-www/ReactDOMTesting-prod.modern.js = 388.45 kB 387.12 kB = 73.53 kB 73.36 kB
oss-experimental/react-dom/cjs/react-dom.profiling.min.js = 135.79 kB 134.99 kB = 43.48 kB 43.31 kB
oss-experimental/react-dom/umd/react-dom.profiling.min.js = 135.43 kB 134.64 kB = 44.09 kB 43.94 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.78 kB 128.99 kB = 41.66 kB 41.49 kB
oss-experimental/react-dom/umd/react-dom.production.min.js = 129.60 kB 128.81 kB = 42.36 kB 42.19 kB
oss-stable/react-dom/cjs/react-dom.profiling.min.js = 127.55 kB 126.76 kB = 40.90 kB 40.74 kB
oss-stable/react-dom/umd/react-dom.profiling.min.js = 127.30 kB 126.51 kB = 41.59 kB 41.41 kB
oss-stable/react-dom/cjs/react-dom.production.min.js = 123.20 kB 122.41 kB = 39.62 kB 39.46 kB
oss-stable/react-dom/umd/react-dom.production.min.js = 123.11 kB 122.32 kB = 40.29 kB 40.13 kB

Generated by 🚫 dangerJS against 40b3ae4

@gaearon
Copy link
Collaborator Author

gaearon commented Feb 8, 2021

Note I added tests for all of these events in ReactDOMEventPropagation-test.js a while ago so we should be safe.

@gaearon gaearon merged commit b4658f2 into facebook:master Feb 8, 2021
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
* Reduce some constant duplication

* Alphabetize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants