perf(render): don’t create an intermediate element array in renderer

This commit is contained in:
Tobias Bosch 2015-06-09 11:41:08 -07:00
parent d07ed581a9
commit 9cd510abaa
1 changed files with 1 additions and 5 deletions

View File

@ -237,10 +237,6 @@ export class DomRenderer extends Renderer {
elementsWithBindingsDynamic = DOM.getElementsByClassName(rootElementClone, NG_BINDING_CLASS); elementsWithBindingsDynamic = DOM.getElementsByClassName(rootElementClone, NG_BINDING_CLASS);
viewRootNodes = [rootElementClone]; viewRootNodes = [rootElementClone];
} }
var elementsWithBindings = ListWrapper.createFixedSize(elementsWithBindingsDynamic.length);
for (var binderIdx = 0; binderIdx < elementsWithBindingsDynamic.length; ++binderIdx) {
elementsWithBindings[binderIdx] = elementsWithBindingsDynamic[binderIdx];
}
var binders = protoView.elementBinders; var binders = protoView.elementBinders;
var boundTextNodes = []; var boundTextNodes = [];
@ -258,7 +254,7 @@ export class DomRenderer extends Renderer {
element = protoView.isTemplateElement ? null : rootElementClone; element = protoView.isTemplateElement ? null : rootElementClone;
childNodes = DOM.childNodes(rootElementClone); childNodes = DOM.childNodes(rootElementClone);
} else { } else {
element = elementsWithBindings[binderIdx - protoView.rootBindingOffset]; element = elementsWithBindingsDynamic[binderIdx - protoView.rootBindingOffset];
childNodes = DOM.childNodes(element); childNodes = DOM.childNodes(element);
} }