Bug 1923996 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This bug is very similar to bug 1900466, but this bug is about the `WeakMap.set` part, not about the proxy creation part.

We spend 3x as much time as Chrome inside `WeakMap.set`. This shows up on Sp3-Vue-TodoMVC and Sp3-NewsSite-Nuxt. On both tests making Firefox as fast as Chrome on this function would reduce its overal time by 0.6%.

It's possible that `WeakMap.set` is slower today than when bug 1900466 was filed.

Chrome: https://share.firefox.dev/4h2PRys (211 samples in Builtins_WeakMapPrototypeSet)
FF: https://share.firefox.dev/3No7qv8 (648 samples in WeakMapObject::set)

```js
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
            if (!(0, _vue_shared__WEBPACK_IMPORTED_MODULE_1__.Kn)(target)) {
                if (false) {}
                return target;
            }
            if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) {
                return target;
            }
            const existingProxy = proxyMap.get(target);
            if (existingProxy) {
                return existingProxy;
            }
            const targetType = getTargetType(target);
            if (targetType === 0) {
                return target;
            }
            const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
            proxyMap.set(target, proxy);
            return proxy;
        }
```
This bug is very similar to bug 1900466, but this bug is about the `WeakMap.set` part, not about the proxy creation part.

We spend 3x as much time as Chrome inside `WeakMap.set`. This shows up on Sp3-Vue-TodoMVC and Sp3-NewsSite-Nuxt. On both tests making Firefox as fast as Chrome on this function would reduce the overall runtime of this subtest in Firefox by 0.6%.

It's possible that `WeakMap.set` is slower today than when bug 1900466 was filed.

Chrome: https://share.firefox.dev/4h2PRys (211 samples in Builtins_WeakMapPrototypeSet)
FF: https://share.firefox.dev/3No7qv8 (648 samples in WeakMapObject::set)

```js
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
            if (!(0, _vue_shared__WEBPACK_IMPORTED_MODULE_1__.Kn)(target)) {
                if (false) {}
                return target;
            }
            if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) {
                return target;
            }
            const existingProxy = proxyMap.get(target);
            if (existingProxy) {
                return existingProxy;
            }
            const targetType = getTargetType(target);
            if (targetType === 0) {
                return target;
            }
            const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
            proxyMap.set(target, proxy);
            return proxy;
        }
```

Back to Bug 1923996 Comment 0