title: Layer-backed NSView performance with rendering directly in CALayer.drawInContext:
body: <p>I have many layer-backed views contained in a <code>NSScrollview</code> and am <em>predominantly concerned with scrolling performance</em>. The <code>documentView</code> and higher are layer-backed hence their subviews are also layer-backed.</p>
  
  <p>The following are the three natural places that display/rendering code could go:</p>
  
  <ol>
  <li>override <code>NSView.wantsUpdateLayer</code> to return false (or don't do anything because this is the default) &amp; do drawing in NSView's <code>drawRect</code> method</li>
  <li>override <code>NSView.wantsUpdateLayer</code> to return true &amp; do drawing in NSView's <code>updateLayer</code> method</li>
  <li>do NO drawing in <code>NSView</code> at all &amp; perform all drawing in CALayer's <code>drawInContext</code> method</li>
  </ol>
  
  <p>From the <em>WWDC 2013 Session 215</em> talk it was stated that (2) is more performant than (1) because the view then doesn't need to create a temporary store for the drawRect output. Firstly, I don't have 100% clarity on when "backing stores" are made and when not and Secondly how do (2) and (3) compare and when might you use one over the other?</p>
  
  <p>In particular, I have to draw text into my view. <strong>How would I go about doing that in the updateLayer call?</strong> The only examples of drawing text seem to need to get hold of a context - which isn't naturally available in <code>updateLayer</code>.</p>