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

perf($compile): Lazily compile the transclude function #12078

Closed
wants to merge 1 commit into from

Commits on Jul 20, 2015

  1. perf($compile): Lazily compile the transclude function

    For transcluded directives, the transclude function can be lazily compiled
    most of the time since the contents will not be needed until the
    `transclude` function was actually invoked.  For example, the `transclude`
    function that is passed to `ng-if` or `ng-switch-when` does not need to be
    invoked until the condition that it's bound to has been matched.  For
    complex trees or switch statements, this can represent significant
    performance gains since compilation of branches is deferred, and that
    compilation may never actually happen if it isn't needed.
    
    There are two instances where compilation will not be lazy; when we scan
    ahead in the array of directives to be processed and find at least two of
    the following:
    
    * A directive that is transcluded and does not allow multiple transclusion
    * A directive that has templateUrl and replace: true
    * A directive that has a template and replace: true
    
    In both of those cases, we will need to continue eager compilation in
    order to generate the multiple transclusion exception at the correct time.
    dcherman committed Jul 20, 2015
    Configuration menu
    Copy the full SHA
    c9ff35c View commit details
    Browse the repository at this point in the history