-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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(reactivity): ports alien-signals
#12349
base: minor
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-ssr
@vue/compiler-sfc
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
❌ Deploy Preview for vue-sfc-playground failed. Why did it fail? →
|
/ecosystem-ci run |
A GC regression that computed not used in effect/template cannot be released is fixed in |
@johnsoncodehk this leak is present in |
@JoviDeCroock Yep! This is the last problem we want to solve in |
alien-signals
systemalien-signals
Removed namespace usage in 571ba05 Previously namespace was used because it somehow showed better perf in benchmarks, but turns out it's because Vitest benchmark currently has overhead for every access of cross-module import binding due to the way modules are evaluated. For real-world performance, we should be benching against the bundled reactivity module, where module-root level exports are scope-hoisted into local consts. This should result in better perf than namespace access. It also is more minifier friendly and can reduce bundle size increase. Comparing the benchmark using bundled
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
alien-signals
(https://github.com/stackblitz/alien-signals) is a research-oriented signal library rewritten based on Vue 3.4's reactivity system. It sets several constraints to ensure the high-performance implementation of a reactivity system. (Currently, it is the fastest implementation among all signal libraries)This PR ports the https://github.com/stackblitz/alien-signals/blob/master/src/system.ts code to https://github.com/vuejs/core/blob/main/packages/reactivity/src/effect.ts to leverage all the optimizations discovered by
alien-signals
.Benefits
Benchmark Results
computed
effect
ref
Potential Improvements
dirtyLevel
,canPropagate
,pauseLevel
, andallowRecurse
into one attribute should further reduce memory usage. Reaching the lowest memory usage is not the purpose of this PR, so we will not implement it here currently.