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 5962cc9
Browse filesBrowse the repository at this point in the historyBrowse files
perf(runtime): weak collections look a value up as is before unwrapping it
Every WeakMap, WeakSet and FinalizationRegistry.unregister call with an
object asked native code for the object's lifetime key, so plain JS keys
and wrappers that are not canaries paid for a native call even when
they were present. A canary is never stored as a key itself (its
lifetime key is), so each method now tries the value as is and asks
for the lifetime key only when that misses, and looks again only when
the lifetime key is another object. set, add and getOrInsert check the
receiver with has(value), which also skips the unwrap when the value is
already present.
Measured on a phone with the reference implementation, a hit: get with
a plain JS key 38 -> 17 ns (16 ns in resurrecting mode), with a wrapper
that is not a canary under scope "extended" 111 -> 16 ns; canary keys
cost 2-5 ns more. A miss still makes the native call.
0 commit comments