RESOLVED FIXED Bug 109617
Teach more WTF string classes about vectors with inline capacity
https://bugs.webkit.org/show_bug.cgi?id=109617
Summary Teach more WTF string classes about vectors with inline capacity
Eric Seidel (no email)
Reported 2013-02-12 14:44:00 PST
Teach more WTF string classes about vectors with inline capacity
Attachments
Patch (3.97 KB, patch)
2013-02-12 14:46 PST, Eric Seidel (no email)
no flags
Patch for landing (4.86 KB, patch)
2013-02-12 15:02 PST, Eric Seidel (no email)
no flags
Eric Seidel (no email)
Comment 1 2013-02-12 14:46:31 PST
Benjamin Poulain
Comment 2 2013-02-12 14:56:14 PST
Comment on attachment 187940 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187940&action=review > Source/WTF/ChangeLog:9 > + I'm about to deploy these all over the HTML/WebVTT parser code > + to make our string creation much less verbose. Let's explain the changes here instead! > Source/WTF/wtf/text/AtomicString.h:67 > + > + template<size_t inlineCapacity> > + explicit AtomicString(Vector<UChar, inlineCapacity> characters) > + : m_string(add(characters.data(), characters.size())) > + { > + } > + This is in the middle of the two constructor from literal. I would instead put this close to the constructors taking a UChar*
Eric Seidel (no email)
Comment 3 2013-02-12 15:02:32 PST
Created attachment 187946 [details] Patch for landing
WebKit Review Bot
Comment 4 2013-02-12 16:42:43 PST
Comment on attachment 187946 [details] Patch for landing Clearing flags on attachment: 187946 Committed r142689: <http://trac.webkit.org/changeset/142689>
WebKit Review Bot
Comment 5 2013-02-12 16:42:47 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6 2013-02-13 09:46:37 PST
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review > Source/WTF/wtf/text/AtomicString.h:53 > + explicit AtomicString(Vector<UChar, inlineCapacity> characters) This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. > Source/WTF/wtf/text/StringImpl.h:358 > + static PassRefPtr<StringImpl> create8BitIfPossible(Vector<UChar, inlineCapacity> vector) Same problem here.
Eric Seidel (no email)
Comment 7 2013-02-13 09:48:52 PST
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review >> Source/WTF/wtf/text/AtomicString.h:53 >> + explicit AtomicString(Vector<UChar, inlineCapacity> characters) > > This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. Ouch! Yes. Fixing now.
Eric Seidel (no email)
Comment 8 2013-02-13 10:06:14 PST
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review >>> Source/WTF/wtf/text/AtomicString.h:53 >>> + explicit AtomicString(Vector<UChar, inlineCapacity> characters) >> >> This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. > > Ouch! Yes. Fixing now. Fixed: bug 109708. In doing this I found that wtf/dota/ uses Vector<char> as an argument all over the place! I suspect it was re-written on top of WTF from stl w/o realizing this. I've filed bug 109709.
Note You need to log in before you can comment on or make changes to this bug.