[webkit-reviews] review requested: [Bug 103295] TextIterator unnecessarily converts 8 bit strings to 16 bits : [Attachment 176338] ANother updated patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 27 14:18:50 PST 2012


Michael Saboff <msaboff at apple.com> has asked  for review:
Bug 103295: TextIterator unnecessarily converts 8 bit strings to 16 bits
https://bugs.webkit.org/show_bug.cgi?id=103295

Attachment 176338: ANother updated patch
https://bugs.webkit.org/attachment.cgi?id=176338&action=review

------- Additional Comments from Michael Saboff <msaboff at apple.com>
(In reply to comment #6)
> (From update of attachment 176308 [details])
> View in context:
https://bugs.webkit.org/attachment.cgi?id=176308&action=review
> 
> This looks like a huge improvement!  However, I think it will be even better
if you don't copy the entire String each time you want to access a single
character :-)
> 
> r- for this reason (or please explain what I'm misunderstanding about your
code change).
> 
> > Source/WebCore/editing/TextIterator.cpp:472
> > +	     return string()[startOffset() + index];
> 
> Currently this makes a copy of the string, then returns one character from
it!
> 
> > Source/WebCore/editing/TextIterator.cpp:480
> > +	     builder.append(string(), startOffset(), length());
> 
> Again, I think this is copying for no real reason...
> 
> > Source/WebCore/editing/TextIterator.h:110
> > +	 String string() const { return m_text; }
> 
> Isn't this making a copy?  I think your original "const String" should
probably have just been "const String&"

Made string() be const String& as suggested.


More information about the webkit-reviews mailing list