зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1246016 - Speed up parent map creation in the memory tool; r=jimb
The iterator protocol is really slow and puts a crap ton of pressure on the GC -- who would have guessed!?
This commit is contained in:
Родитель
073eab9c8f
Коммит
f96d54f1b4
|
@ -574,7 +574,8 @@ const createParentMap = exports.createParentMap = function (node,
|
||||||
getId = node => node.id,
|
getId = node => node.id,
|
||||||
aggregator = Object.create(null)) {
|
aggregator = Object.create(null)) {
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
for (let child of node.children) {
|
for (let i = 0, length = node.children.length; i < length; i++) {
|
||||||
|
const child = node.children[i];
|
||||||
aggregator[getId(child)] = node;
|
aggregator[getId(child)] = node;
|
||||||
createParentMap(child, getId, aggregator);
|
createParentMap(child, getId, aggregator);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче