feat: add Value.Hash O(1) change detection before Value.Equal in reconciler
Adds hash field to Fiber<I> for caching FNV-1a hash after each commit. Hash comparison runs before Value.Equal in reconcileProps for fast bail-out on unchanged subtrees. Hashes computed during commit phase only (outside reactive computations) via commitHashes after commitEffects.
This commit is contained in:
@@ -74,6 +74,7 @@ export function createRoot<TTag extends string, Instance, RootCtx>(
|
||||
prevProps: null,
|
||||
cachedNode: node,
|
||||
disposed: false,
|
||||
hash: null,
|
||||
};
|
||||
if (parentFiber) parentFiber.children.push(fiber);
|
||||
return fiber;
|
||||
@@ -112,6 +113,7 @@ export function createRoot<TTag extends string, Instance, RootCtx>(
|
||||
prevProps: null,
|
||||
cachedNode: node,
|
||||
disposed: false,
|
||||
hash: null,
|
||||
};
|
||||
|
||||
for (const child of el.children) {
|
||||
@@ -140,6 +142,7 @@ export function createRoot<TTag extends string, Instance, RootCtx>(
|
||||
prevProps: null,
|
||||
cachedNode: node,
|
||||
disposed: false,
|
||||
hash: null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -168,6 +171,7 @@ export function createRoot<TTag extends string, Instance, RootCtx>(
|
||||
prevProps: null,
|
||||
cachedNode: node,
|
||||
disposed: false,
|
||||
hash: null,
|
||||
};
|
||||
|
||||
for (const child of el.children) {
|
||||
@@ -293,6 +297,7 @@ export function createRoot<TTag extends string, Instance, RootCtx>(
|
||||
prevProps: null,
|
||||
cachedNode: null,
|
||||
disposed: false,
|
||||
hash: null,
|
||||
};
|
||||
const payloadChildren = isURoot(node) ? (node as URoot).children : [node];
|
||||
for (const child of payloadChildren) {
|
||||
|
||||
Reference in New Issue
Block a user