Vue's createReactiveObject is 2.8x slower in SM than V8 due to StoreBuffer overhead in WeakMap.set
Categories
(Core :: JavaScript Engine: JIT, defect, P2)
Tracking
()
People
(Reporter: mstange, Unassigned)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [sp3])
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)
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;
}
Updated•2 years ago
|
Updated•1 year ago
|
| Reporter | ||
Comment 1•1 year ago
|
||
Jon, is this something you could look at? Is the StoreBuffer part new?
Updated•1 year ago
|
Updated•1 year ago
|
Comment 2•1 year ago
|
||
This seems worth investigating, but I don't think we have a clear enough idea of what's going on or how we would fix it to mark it as js-perf-next.
Comment 3•6 months ago
|
||
Is this still slow after the work done in bug 1821107 and dependents?
Comment 4•6 months ago
|
||
Comparing equivalent profiles of SP3, I see 245 samples in SM vs 414 samples in V8. So it's certainly plausible that something under bug 1821107 helped, although I'm not sure exactly what.
Comment 5•2 months ago
|
||
We're spending less time in WeakMap::set than V8, and I don't see createReactiveObject in comparison reports. I'm closing this.
Description
•