Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

perf($compile): avoid .data when fetching required controllers #11059

Closed

Conversation

jbedard
Copy link
Collaborator

@jbedard jbedard commented Feb 14, 2015

This changes getControllers to try fetching controllers from elementControllers which in many cases can avoid calling .data. For a largetable-bp benchmark of <input ng-model="foo"> elements this reduces the create step GC about 50% (which seems crazy, but that's what chrome keeps claiming...) and improves the time 5-10%.

(this was originally part of #9772)

value.push(getControllers(directiveName, require, $element, elementControllers));
});
value = new Array(i = require.length);
while (i--) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I find

for (i=0, ii = requite.length; i < ii; ++i) {
  ...
}

much easier to read (unless that for some specific reason we want to run this in reverse order)

@lgalfaso
Copy link
Contributor

otherwise, LGTM

@jbedard jbedard force-pushed the compile-controller-perf-getcontrollers branch from e66fca7 to 1a818a2 Compare February 15, 2015 11:07
@jbedard
Copy link
Collaborator Author

jbedard commented Feb 15, 2015

Updated...

@lgalfaso
Copy link
Contributor

landed as fa0aa83

@lgalfaso lgalfaso closed this Feb 16, 2015
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants