I think we have multiple issues: - We have many calls to `js::ArraySliceDense`, which is likely part of the memory usage. - The first one being that this function `Q` is something that we could probably optimize. - The function `Q` seems to be responsible for a large part of the allocations. I guess this might be the `Q` function in question: ``` function Q(t, e, n, i) { if (i && t) { var r = (0, u.Vv) (i.value, i.kind, i.propertyType); if (r > - 1) { var o = t[Z]; o || (o = t[Z] = { f: { } }); var a = o[K]; if (a || (a = o[K] = {}), e) for (var s = 0; s < e.length; s++) { var l = e[s]; a[l] || (a[l] = { f: { } }); var d = a[l][K]; d || (d = a[l][K] = {}), a = d } a = a[n] = {}, (0, c.kJ) (i.value) ? a.a = { t: r } : a.t = r } } } ``` This single function makes me think that they have re-implemented some shadow-DOM like interface. Maybe we can have some ref-counted object for shadow-DOM like objects? Or have the GC hint on what would be interesting to treat as a single-holder node for a sea of held objects?
Bug 1911035 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I think we have multiple issues: - We have many calls to `js::ArraySliceDense`, which is likely part of the memory usage. - The first one being that this function `Q` is something that we could probably optimize. - The function `Q` seems to be responsible for a large part of the allocations. I guess this might be the `Q` function in question: ```js function Q(t, e, n, i) { if (i && t) { var r = (0, u.Vv) (i.value, i.kind, i.propertyType); if (r > - 1) { var o = t[Z]; o || (o = t[Z] = { f: { } }); var a = o[K]; if (a || (a = o[K] = {}), e) for (var s = 0; s < e.length; s++) { var l = e[s]; a[l] || (a[l] = { f: { } }); var d = a[l][K]; d || (d = a[l][K] = {}), a = d } a = a[n] = {}, (0, c.kJ) (i.value) ? a.a = { t: r } : a.t = r } } } ``` This single function makes me think that they have re-implemented some shadow-DOM like interface. Maybe we can have some ref-counted object for shadow-DOM like objects? Or have the GC hint on what would be interesting to treat as a single-holder node for a sea of held objects?