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:
2026-05-18 17:38:27 +00:00
parent 84498f6b58
commit 6d704f59e0
5 changed files with 317 additions and 1 deletions

View File

@@ -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) {