Skip to content

[wip] optimizations for compat#2742

Merged
JoviDeCroock merged 16 commits into
v11from
v11-compat-optimizations
Sep 13, 2020
Merged

[wip] optimizations for compat#2742
JoviDeCroock merged 16 commits into
v11from
v11-compat-optimizations

Conversation

@developit

@developit developit commented Sep 4, 2020

Copy link
Copy Markdown
Member

This reduces vnode normalization to a single loop over props with no megamorphic property access and no shape mutations caused by delete. These don't show up in our CI benchmarks because they're only in compat.

Here's the demo+details for the UNSAFE_ prefix change any why it works:
https://codesandbox.io/s/preact-x-react-table-6103-forked-4q3l8?file=/src/patch.js:185-307

This PR also fixes #1989 - instead of using onchange as-is for <input type=range>, it uses oninput in all browsers except IE11 (which fires continuous onchange for range inputs, the original bug).

I've incorporated the relevant bits from #2665 as well (everything outside of src/render.js).

It might be worth backporting the prop+event normalization stuff from this into v10 - it's pretty safe, and around 150b savings along with the performance boost.

@github-actions

github-actions Bot commented Sep 4, 2020

Copy link
Copy Markdown

Size Change: -742 B (1%)

Total Size: 40 kB

Filename Size Change
compat/dist/compat.js 3.1 kB -243 B (7%)
compat/dist/compat.module.js 3.1 kB -253 B (8%)
compat/dist/compat.umd.js 3.14 kB -246 B (7%)
ℹ️ View Unchanged
Filename Size Change
debug/dist/debug.js 3.2 kB 0 B
debug/dist/debug.module.js 3.18 kB 0 B
debug/dist/debug.umd.js 3.29 kB 0 B
devtools/dist/devtools.js 185 B 0 B
devtools/dist/devtools.module.js 195 B 0 B
devtools/dist/devtools.umd.js 261 B 0 B
dist/preact.js 3.88 kB 0 B
dist/preact.min.js 3.9 kB 0 B
dist/preact.module.js 3.9 kB 0 B
dist/preact.umd.js 3.93 kB 0 B
hooks/dist/hooks.js 1.09 kB 0 B
hooks/dist/hooks.module.js 1.11 kB 0 B
hooks/dist/hooks.umd.js 1.17 kB 0 B
test-utils/dist/testUtils.js 437 B 0 B
test-utils/dist/testUtils.module.js 439 B 0 B
test-utils/dist/testUtils.umd.js 515 B 0 B

compressed-size-action

@developit developit marked this pull request as ready for review September 11, 2020 21:37
developit added a commit that referenced this pull request Sep 11, 2020
Signed-off-by: Jason Miller <developit@users.noreply.github.com>
@developit

Copy link
Copy Markdown
Member Author

@JoviDeCroock since we merge the backport of this to master, I think it might be best to also merge this PR to v11 now.

@JoviDeCroock JoviDeCroock merged commit 955dd45 into v11 Sep 13, 2020
@JoviDeCroock JoviDeCroock deleted the v11-compat-optimizations branch September 13, 2020 20:02
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.

3 participants