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

WIP: Even more perf #8515

Closed
wants to merge 83 commits into from
Closed

Conversation

IgorMinar
Copy link
Contributor

this needs a lot of rebasing and polish still. I started off with @petebacondarwin's PR and added a bunch of stuff on top of it + threw in my benchpress benchmarks.

petebacondarwin and others added 10 commits July 31, 2014 11:55
The compiler and ngBind directives add binding information (`ng-binding`
CSS class and `$binding` data object) to elements when they are bound to
the scope. This is only to aid testing and debugging for tools such as
Protractor and Batarang. In production this is unneccesary and add a
performance penalty.

This change disables adding this binding information by default. You can
enable it by calling `$compilerProvider.enableBindingInfo()` in a module
`config()` block.

BREAKING CHANGE:

The `ng-binding` CSS class and the `$binding` data object are no longer
attached to DOM elements that have a binding to the scope, by default.
If you relied on this feature then you can re-enable it in one of your
application modules:

```
someModule.config(['$compileProvider', function($compileProvider) {
  $compileProvider.enableBindingInfo();
}]);
```
Node.contains is supported on IE5+ and all the other browsers we care about.
off() is called on each element removal, so we want to make it as fast as possible
@IgorMinar IgorMinar added this to the 1.3.0-beta.18 milestone Aug 6, 2014
@IgorMinar
Copy link
Contributor Author

@mzgol I removed a bunch of old stuff from jqlite. just fyi

@jimmywarting
Copy link
Contributor

remove createXhr() method completely aswell?

@mgol
Copy link
Member

mgol commented Aug 7, 2014

@IgorMinar thanks for the heads up. As for perf & size, httpBackend could have its xhr handling rewritten to not rely on onreadystatechange but regular onload & friends. Such a switch was done in jQuery 2 as well and it works fine.

This even is fired purely within jqLite/jQuery so it doesn't make sense to register DOM listener here.

6% improvement in large table benchmark for both creation and destruction
Functions with try/catch block can't be optimized, so we can
move the try/catch block into a tiny fn and make it possible for the
complex nodeLinkFn to get optimized.
This doesn't show up too high in profiles, but this code is cleaner anyway
while querySelectorAll is much more expensive than getElementsByTagName on elements with
both many and few children, cloning the live node list returned by getElementsByTagName
makes it as expensive as querySelectorAll (we need to clone because we need the node list
not to change while we iterate over it).

the childNodes and childNodes.length check is as expensive as querySelectorAll on a node
without any children, so it only makes the whole lookup 2x as slow, so I'm removing it.
the previousNode was almost always correct except when we added a new block in which case incorrectly
assigned the cloned collection to the variable instead of the end comment node.
…ment-transclusion templates

Previously we would do it manually in all of our structural directives.

BREAKING CHANGE: element-transcluded directives now have an extra comment automatically appended to their cloned DOM

This comment is usually needed to keep track the end boundary in the event child directives modify the root node(s).
If not used for this purpose it can be safely ignored.
…ng added

This branch is not as hot as the single node branch and the slice that we need for old webkit/phantom makes for loop preferable.
the comment was moved to template but we can't clone the template via document fragment because
for 1-5 elements document fragment is only an extra overhead. It only starts to make things faster
when we have 10 or more root elements to clone and append
@btford btford removed the gh: PR label Aug 20, 2014
@tbosch tbosch modified the milestones: 1.3.0-beta.19, 1.3.0-rc.0 Aug 27, 2014
@matsko matsko modified the milestones: 1.3.0-rc.0, 1.3.0-rc.1 Aug 30, 2014
@jeffbcross jeffbcross modified the milestones: 1.3.0-rc.1, 1.3.0-rc.2 Sep 9, 2014
@IgorMinar
Copy link
Contributor Author

most of these commits landed in master already and the remaining todo notes were committed as 90cd1e0

@IgorMinar IgorMinar closed this Sep 9, 2014
IgorMinar added a commit that referenced this pull request Sep 9, 2014
mgallag pushed a commit to mgallag/angular.js that referenced this pull request Sep 10, 2014
mgallag pushed a commit to mgallag/angular.js that referenced this pull request Sep 10, 2014
mgallag pushed a commit to mgallag/angular.js that referenced this pull request Sep 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.