You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 833cbdd
Browse filesBrowse the repository at this point in the historyBrowse files
perf(signals): shared traps for merge()/omit() proxies, state on the target
Each merge()/omit() proxy allocated a target holding three fresh closures
(get/has/keys) over the instance's sources and forwarded every trap call
through them. Keep the sources/keys on the target under symbol keys and
share one handler per primitive instead: a props proxy is a Proxy plus a
one- or two-slot object, and a read goes straight from the trap to the
sources. The state keys are never reported by ownKeys nor answered by
get/has; a string defineProperty on the proxy lands on the target without
touching them (previously it could overwrite the target's `get` method).
Behaviour is unchanged: `$SOURCES` still answers the flat list on a merge
proxy (mergeSources/spread) and undefined on an omit proxy (#3014); the
has/ownKeys filtering is the same. Port of #3391 (main) to next.
Interleaved A/B, old vs new dist in one process, on battery (±20% noise):
retained 200-instance merge+omit batch 0.87–0.93×, nested merge over a
merge proxy 0.65–0.75×, Object.keys / spread 0.90–0.98×; single
construct and reads within noise in process-isolated alternating runs.
Co-authored-by: Cursor <[email protected]>
`merge()` and `omit()` proxies keep their per-instance state on the proxy target under symbol keys and share one handler each, instead of allocating a target with three closures (`get`/`has`/`keys`) per instance and forwarding every trap through them. Creating a props proxy is now a proxy plus a one- or two-slot object, and reads go straight from the trap to the sources. The state keys are never reported or answered through the proxy, and a string `defineProperty` on the proxy can no longer clobber its internals. Port of solidjs/solid#3391 to the 2.0 primitives.
0 commit comments