title: DOM manipulation done in compile phase runs once, and propagate always - what this means
body: <p>I'm reading <a href="https://www.airpair.com/angularjs/posts/angularjs-performance-large-applications#10-2-the-compile-cycle" rel="noreferrer">this article</a> about angular performance optimization and there is the following passage there:</p>
  
  <blockquote>
    <p>Directive's compile functions run before scope is attached and are the
    perfect place to run any DOM manipulations (binding events for
    example). The important thing to recognize from a performance point of
    view, is that the element and attributes passed into the compile
    function represent the raw html template, before any of angular's
    changes have been made. What this means in practice is that DOM
    manipulation done here, will run once, and propagate always. Another
    important point that is frequently glossed over is the difference
    between prelink and postlink. In short, prelinks run from the outside
    in, while postlinks run from the inside out. As such, prelinks offer a
    slight performance boost, as they prevent the inner directives from
    running a second digest cycle when the parent modifies scope in the
    prelink. However, child DOM may not yet be available.</p>
  </blockquote>
  
  <p>I can't understand these two parts and how I can use it to boost performance:</p>
  
  <blockquote>
    <p>What this means in practice is that DOM
    manipulation done here, will run once, and propagate always.</p>
  </blockquote>
  
  <p>And this</p>
  
  <blockquote>
    <p>prelinks offer a
    slight performance boost, as they prevent the inner directives from
    running a second digest cycle when the parent modifies scope in the
    prelink</p>
  </blockquote>
  
  <p>I'd appreciate if anyone could elobarate on that.</p>