title: Is there a way to speed up HTML to NSAttributedString rendering in iOS 8?
body: <p>I may be wrong, but it seems <em>a lot</em> slower than it was in iOS 7. It's all but unusable in production with iOS 8.</p>
  
  <p>The following line:</p>
  
  <pre><code>NSString *htmlString = @"&lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt;";
  [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)} documentAttributes:nil error:nil];
  </code></pre>
  
  <p>Takes <strong>0.48 seconds</strong> to execute. Half a second to parse two simple HTML tags.</p>
  
  <p>But I'm wondering if there's something weird going on, as if I use the HTML string:</p>
  
  <pre><code>NSString *htmlString = @"&lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt; and &lt;a href='http://google.ca'&gt;google&lt;/a&gt; with some &lt;sup&gt;superscript&lt;/sup&gt; and some &lt;sub&gt;subscript&lt;/sub&gt; and a &lt;h1&gt;header&lt;/h1&gt; followed by some &lt;strong&gt;&lt;em&gt;nested bold and italics&lt;/em&gt;&lt;/strong&gt; plus some &lt;em&gt;neato&lt;/em&gt; and some more &lt;a href='#'&gt;well then&lt;/a&gt; with a bit of &lt;del&gt;strikethrough&lt;/del&gt; and other text &lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt; and &lt;a href='http://google.ca'&gt;google&lt;/a&gt; with some &lt;sup&gt;superscript&lt;/sup&gt; and some &lt;sub&gt;subscript&lt;/sub&gt; and a &lt;h1&gt;header&lt;/h1&gt; followed by some &lt;strong&gt;&lt;em&gt;nested bold and italics&lt;/em&gt;&lt;/strong&gt; plus some &lt;em&gt;neato&lt;/em&gt; and some more &lt;a href='#'&gt;well then&lt;/a&gt; with a bit of &lt;del&gt;strikethrough&lt;/del&gt; and other text &lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt; and &lt;a href='http://google.ca'&gt;google&lt;/a&gt; with some &lt;sup&gt;superscript&lt;/sup&gt; and some &lt;sub&gt;subscript&lt;/sub&gt; and a &lt;h1&gt;header&lt;/h1&gt; followed by some &lt;strong&gt;&lt;em&gt;nested bold and italics&lt;/em&gt;&lt;/strong&gt; plus some &lt;em&gt;neato&lt;/em&gt; and some more &lt;a href='#'&gt;well then&lt;/a&gt; with a bit of &lt;del&gt;strikethrough&lt;/del&gt; and other text &lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt; and &lt;a href='http://google.ca'&gt;google&lt;/a&gt; with some &lt;sup&gt;superscript&lt;/sup&gt; and some &lt;sub&gt;subscript&lt;/sub&gt; and a &lt;h1&gt;header&lt;/h1&gt; followed by some &lt;strong&gt;&lt;em&gt;nested bold and italics&lt;/em&gt;&lt;/strong&gt; plus some &lt;em&gt;neato&lt;/em&gt; and some more &lt;a href='#'&gt;well then&lt;/a&gt; with a bit of &lt;del&gt;strikethrough&lt;/del&gt; and other text &lt;em&gt;emphasis&lt;/em&gt; with some &lt;strong&gt;bolder text&lt;/strong&gt; and &lt;a href='http://google.ca'&gt;google&lt;/a&gt; with some &lt;sup&gt;superscript&lt;/sup&gt; and some &lt;sub&gt;subscript&lt;/sub&gt; and a &lt;h1&gt;header&lt;/h1&gt; followed by some &lt;strong&gt;&lt;em&gt;nested bold and italics&lt;/em&gt;&lt;/strong&gt; plus some &lt;em&gt;neato&lt;/em&gt; and some more &lt;a href='#'&gt;well then&lt;/a&gt; with a bit of &lt;del&gt;strikethrough&lt;/del&gt; and other text";
  </code></pre>
  
  <p>Which is an HTML string <strong>33x</strong> longer, and it takes <strong>0.51 seconds</strong>. </p>
  
  <p>So the string is <strong>33x longer</strong> but takes only <strong>1.06</strong> times longer (or 0.03 seconds longer) to render.</p>
  
  <p>Is there just an absurd startup time I can mitigate somehow? This seems like it's taking a very unreasonable amount of time to render, whereas in iOS 7 I could almost remember it being instantaneous.</p>
  
  <p><sub>If not, any recommendations for an alternative HTML to NSAttributedString solution?</sub></p>