perf(router-core): faster enumerable-key collection in structural sharing (#8010)
* perf(router-core): faster enumerable-key collection in structural sharing getEnumerableOwnKeys (used by replaceEqualDeep) called Object.getOwnPropertyNames and then invoked propertyIsEnumerable once per key to verify every own string prop is enumerable. Replace that O(n) loop of JS method calls with Object.keys (native, enumerable-only) plus a single length comparison against getOwnPropertyNames to detect non-enumerable string props. Symbol handling is unchanged. Behavior is identical (verified against the existing suite + fuzzing): the function still returns the enumerable own keys in the same order and still bails (returns false) for objects with any non-enumerable own string or symbol property. replaceEqualDeep runs on every selector result on every state update when defaultStructuralSharing is enabled, so this is a hot client path for selector-heavy apps. Measured ~1.3-1.5x faster on typical router state. * style(router-core): address enumerable key review --------- Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
F
Flo committed
5253e70db2083d68a788fb7c9a043bb0c5518f2a
Parent: c568caf
Committed by GitHub <noreply@github.com>
on 8/8/2026, 5:20:08 PM