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:
Nick Fitzgerald 2016-02-04 16:25:00 +01:00
Родитель 073eab9c8f
Коммит f96d54f1b4
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -574,7 +574,8 @@ const createParentMap = exports.createParentMap = function (node,
getId = node => node.id,
aggregator = Object.create(null)) {
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;
createParentMap(child, getId, aggregator);
}