Skip to content

perf(runtime-vapor): implement dynamic props/slots source caching#14208

Merged
edison1105 merged 5 commits intominorfrom
edison/perf/cacheDynamicFunctionSource
Dec 16, 2025
Merged

perf(runtime-vapor): implement dynamic props/slots source caching#14208
edison1105 merged 5 commits intominorfrom
edison/perf/cacheDynamicFunctionSource

Conversation

@edison1105
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings December 16, 2025 06:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 16, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edison/perf/cacheDynamicFunctionSource

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 16, 2025

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 85.2 kB 29.9 kB 26.4 kB
runtime-dom.global.prod.js 108 kB 40.6 kB 36.5 kB
vue.global.prod.js 166 kB 60.5 kB 53.9 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.2 kB 18.9 kB 17.3 kB
createApp 57.2 kB 22 kB 20.1 kB
createApp + vaporInteropPlugin 96.3 kB (+142 B) 35.6 kB (+45 B) 32 kB (+1 B)
createVaporApp 42.3 kB (+146 B) 15.6 kB (+34 B) 14.2 kB (+55 B)
createSSRApp 61.6 kB 23.8 kB 21.7 kB
defineCustomElement 63.3 kB 23.9 kB 21.8 kB
overall 71.9 kB 27.2 kB 24.8 kB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 16, 2025

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14208
npm i https://pkg.pr.new/@vue/compiler-core@14208
yarn add https://pkg.pr.new/@vue/compiler-core@14208.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14208
npm i https://pkg.pr.new/@vue/compiler-dom@14208
yarn add https://pkg.pr.new/@vue/compiler-dom@14208.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14208
npm i https://pkg.pr.new/@vue/compiler-sfc@14208
yarn add https://pkg.pr.new/@vue/compiler-sfc@14208.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14208
npm i https://pkg.pr.new/@vue/compiler-ssr@14208
yarn add https://pkg.pr.new/@vue/compiler-ssr@14208.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@14208
npm i https://pkg.pr.new/@vue/compiler-vapor@14208
yarn add https://pkg.pr.new/@vue/compiler-vapor@14208.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14208
npm i https://pkg.pr.new/@vue/reactivity@14208
yarn add https://pkg.pr.new/@vue/reactivity@14208.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14208
npm i https://pkg.pr.new/@vue/runtime-core@14208
yarn add https://pkg.pr.new/@vue/runtime-core@14208.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14208
npm i https://pkg.pr.new/@vue/runtime-dom@14208
yarn add https://pkg.pr.new/@vue/runtime-dom@14208.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@14208
npm i https://pkg.pr.new/@vue/runtime-vapor@14208
yarn add https://pkg.pr.new/@vue/runtime-vapor@14208.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14208
npm i https://pkg.pr.new/@vue/server-renderer@14208
yarn add https://pkg.pr.new/@vue/server-renderer@14208.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14208
npm i https://pkg.pr.new/@vue/shared@14208
yarn add https://pkg.pr.new/@vue/shared@14208.tgz

vue

pnpm add https://pkg.pr.new/vue@14208
npm i https://pkg.pr.new/vue@14208
yarn add https://pkg.pr.new/vue@14208.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14208
npm i https://pkg.pr.new/@vue/compat@14208
yarn add https://pkg.pr.new/@vue/compat@14208.tgz

commit: 0dda041

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a performance optimization by adding caching for dynamic props and slots sources. Previously, when a component accessed multiple props from the same v-bind source (e.g., v-bind="obj"), the source function was called multiple times. Now it's cached using a computed ref, so the source is only evaluated once per reactive update cycle.

Key changes:

  • Created a generic resolveDynamicFunctionSource utility that caches function results using computed refs
  • Consolidated caching logic from componentSlots.ts into componentProps.ts for reuse
  • Updated all dynamic source resolution sites to use the new caching function

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/runtime-vapor/src/componentSlots.ts Removed local resolveDynamicSlot function and updated to use the shared resolveDynamicFunctionSource from componentProps
packages/runtime-vapor/src/componentProps.ts Added resolveDynamicFunctionSource with computed-based caching and scope disposal, updated all dynamic source resolution call sites to use it
packages/runtime-vapor/__tests__/componentProps.spec.ts Added comprehensive tests validating that v-bind sources are cached when multiple props are accessed and that reactivity still works correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@edison1105 edison1105 added the scope: vapor related to vapor mode label Dec 16, 2025
@edison1105 edison1105 merged commit 1428c06 into minor Dec 16, 2025
17 checks passed
@edison1105 edison1105 deleted the edison/perf/cacheDynamicFunctionSource branch December 16, 2025 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants