perf: hoist rest_props exclude list as a module-scope Set (#18252)
The compiler emitted an inline string array as the second argument to `$.rest_props(...)`, and the runtime did a linear `Array.prototype.includes` on it on every property access via the rest-props Proxy. The exclude list only depends on the component definition, not on the instance, so it can be hoisted to module scope and shared by every instance. Switching it to a `Set` at the same time makes each lookup O(1). For a component like `<Button ...rest />` rendered N times, this turns one per-instance allocation (plus a linear search on every rest-prop access) into one module-scope allocation plus O(1) lookups. The legacy `$$restProps` path is unchanged — it mutates the exclude list in its `deleteProperty` trap, so it can't share a hoisted Set across instances. --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>
M
Mathias Picker committed
a40c745fd95e855a7c667b24ee6bb149783d1813
Parent: 980c7e2
Committed by GitHub <noreply@github.com>
on 5/29/2026, 7:55:07 PM