perf(reactivity): improve reactive effect memory usage (#4001)
Based on #2345 , but with smaller API change - Use class implementation for `ReactiveEffect` - Switch internal creation of effects to use the class constructor - Avoid options object allocation - Avoid creating bound effect runner function (used in schedulers) when not necessary. - Consumes ~17% less memory compared to last commit - Introduces a very minor breaking change: the `scheduler` option passed to `effect` no longer receives the runner function.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
isReactive,
|
||||
reactive,
|
||||
stop,
|
||||
track,
|
||||
TrackOpTypes,
|
||||
trigger,
|
||||
@@ -575,7 +574,7 @@ function installCompatMount(
|
||||
// stop effects
|
||||
if (effects) {
|
||||
for (let i = 0; i < effects.length; i++) {
|
||||
stop(effects[i])
|
||||
effects[i].stop()
|
||||
}
|
||||
}
|
||||
// unmounted hook
|
||||
|
||||
Reference in New Issue
Block a user