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

perf(runtime-vapor): use setAttr or setDOMProp instead of setDynamicProp when possible #291

Merged

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Nov 17, 2024

the setDynamicProp function internally checks whether the key is class, style, event each time, which increases runtime overhead. This PR optimizes the process to minimize the use of setDynamicProp by:

  • using setAttr for attributes that must be set with setAttribute
  • using setDOMProp for global HTML attributes, global Svg attributes, and global MathML attributes.
    • common elements like div,span,p,table,h1-h6 do not have additional attributes beyond the global HTML attributes.

Copy link

netlify bot commented Nov 17, 2024

Deploy Preview for vapor-repl ready!

Name Link
🔨 Latest commit 8d98009
🔍 Latest deploy log https://app.netlify.com/sites/vapor-repl/deploys/67413c9c76857a000871ba5e
😎 Deploy Preview https://deploy-preview-291--vapor-repl.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@autofix-troubleshooter
Copy link

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

Copy link

github-actions bot commented Nov 17, 2024

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 81 kB 28.4 kB 25.1 kB
runtime-dom.global.prod.js 100 kB 38 kB 34.2 kB
runtime-vapor.global.prod.js 47.8 kB (+48 B) 18.1 kB (+25 B) 16.6 kB (+31 B)
vue-vapor.global.prod.js 47.8 kB (+48 B) 18.1 kB (+27 B) 16.6 kB (+23 B)
vue.global.prod.js 158 kB 57.8 kB 51.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.4 kB 18.4 kB 16.8 kB
createApp 55.5 kB 21.4 kB 19.5 kB
createVaporApp 27.3 kB (+65 B) 10.4 kB (+23 B) 9.6 kB (+35 B)
createSSRApp 59.5 kB 23.1 kB 21 kB
defineCustomElement 60.3 kB 23 kB 20.9 kB
overall 69.3 kB 26.5 kB 24.1 kB

Copy link

pkg-pr-new bot commented Nov 17, 2024

Open in Stackblitzplayground

@vue/compiler-core

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compiler-core@291

@vue/compiler-dom

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compiler-dom@291

@vue/compiler-ssr

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compiler-ssr@291

@vue/compiler-vapor

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compiler-vapor@291

@vue/compiler-sfc

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compiler-sfc@291

@vue/reactivity

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/reactivity@291

@vue/runtime-core

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/runtime-core@291

@vue/runtime-dom

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/runtime-dom@291

@vue/runtime-shared

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/runtime-shared@291

@vue/runtime-vapor

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/runtime-vapor@291

@vue/server-renderer

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/server-renderer@291

@vue/shared

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/shared@291

vue

pnpm add https://pkg.pr.new/vuejs/vue-vapor/vue@291

@vue/compat

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/compat@291

@vue/vapor

pnpm add https://pkg.pr.new/vuejs/vue-vapor/@vue/vapor@291

commit: 8d98009

Copy link

netlify bot commented Nov 17, 2024

Deploy Preview for vapor-template-explorer failed. Why did it fail? →

Name Link
🔨 Latest commit bf0ab38
🔍 Latest deploy log https://app.netlify.com/sites/vapor-template-explorer/deploys/6739f7256ee0b30008aab159

Copy link

netlify bot commented Nov 17, 2024

Deploy Preview for vapor-template-explorer ready!

Name Link
🔨 Latest commit 8d98009
🔍 Latest deploy log https://app.netlify.com/sites/vapor-template-explorer/deploys/67413c9cd770d70008184f06
😎 Deploy Preview https://deploy-preview-291--vapor-template-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@edison1105 edison1105 changed the title perf(runtime-vapor): use setAttr for attributes that must be set as attirbute perf(runtime-vapor): use setAttr or setDOMProp instead of setDynamicProp Nov 18, 2024
@edison1105 edison1105 marked this pull request as ready for review November 18, 2024 02:24
Copy link
Member

@LittleSound LittleSound left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks

@edison1105 edison1105 changed the title perf(runtime-vapor): use setAttr or setDOMProp instead of setDynamicProp perf(runtime-vapor): use setAttr or setDOMProp instead of setDynamicProp when possible Nov 22, 2024
@edison1105 edison1105 requested a review from Doctor-wu November 23, 2024 02:27
@LittleSound LittleSound merged commit e61cedf into vuejs:main Nov 27, 2024
10 checks passed
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.

4 participants