<div dir="ltr"><div> raw_ostream &RewriteBuffer::write(raw_ostream &os) const {</div><div>-  // FIXME: eliminate the copy by writing out each chunk at a time</div><div>-  os << std::string(begin(), end());</div>
<div>+  for (RopePieceBTreeIterator I = begin(), E = end(); I != E;</div><div>+       I.MoveToNextPiece())</div><div>+    os << I.piece();</div><div>   return os;</div><div><br></div><div>Why's it not ok to write ++I? (if there is a good reason, a comment might help...)</div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 1:41 AM, Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Updated patch to use StringRef instead of RopePieceBTreeIterator internals.<br>
<br>
Check it out<br>
<span class="HOEnZb"><font color="#888888"><br>
Alp.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 07/11/2013 07:08, Alp Toker wrote:<br>
> Rewrite was previously allocating potentially huge std::strings with<br>
> each call and filling it one character at a time.<br>
><br>
> This has become a hot path for Refactoring, Modernize, FixIt, Format,<br>
> and particularly ARCMT/ObjCMT which call it multiple times on the full<br>
> source tree -- so copying out contiguous chunks while avoiding large<br>
> allocations is a good idea.<br>
><br>
> This commit preserves the existing interface of RewriteRope and pokes<br>
> into it directly for access to the byte vectors.<br>
><br>
> Resolves a FIXME back from r101521. No change in behaviour.<br>
><br>
<br>
--<br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>