Skip to content

Commit 89c5e8f

Browse files
committed
perf(system): don't update System.queuedEffects if next notify effect exists
1 parent 2e3df7e commit 89c5e8f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/system.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,19 @@ export function endBatch(): void {
5858
}
5959

6060
export function drainQueuedEffects(): void {
61-
while (System.queuedEffects !== undefined) {
62-
const effect = System.queuedEffects;
63-
const queuedNext = System.queuedEffects.nextNotify;
61+
let effect = System.queuedEffects;
62+
while (effect !== undefined) {
63+
const queuedNext = effect.nextNotify;
6464
if (queuedNext !== undefined) {
65-
System.queuedEffects.nextNotify = undefined;
66-
System.queuedEffects = queuedNext;
65+
effect.nextNotify = undefined;
66+
effect.notify();
67+
effect = queuedNext;
6768
} else {
6869
System.queuedEffects = undefined;
6970
System.queuedEffectsTail = undefined;
71+
effect.notify();
72+
effect = System.queuedEffects;
7073
}
71-
effect.notify();
7274
}
7375
}
7476

0 commit comments

Comments
 (0)