Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Pre-compute ViewFactory linking checks #1194

@jbdeboer

Description

@jbdeboer

The following line came up hot in a profile of the TreeComponent benchmark.

https://github.com/angular/angular.dart/blob/c21ac7eaec3fd15bba7a124fdfb3e9680092a0f2/lib/core_dom/tagging_view_factory.dart#L72

The call to Element.classes.contains() involves an expensive HashMap and should be avoided.

Since the nodeList is generally a clone of the template nodes, we can pre-compute this check in the Compiler and pass it in with the templateNodes.

In fact, we could go further and pre-compute other checks as well:

  • whether or not the node has a parentNode
  • if the node is an Element or a Text / Comment node
  • if the node has any children .ng-binding elements (if not, we can skip the querySelectorAll check

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions