RESOLVED FIXED 32151
String::append(const String& str) check whether str.length() != 0
https://bugs.webkit.org/show_bug.cgi?id=32151
Summary String::append(const String& str) check whether str.length() != 0
Zoltan Herczeg
Reported 2009-12-04 05:08:45 PST
In CachedScript.cpp: const String& CachedScript::script() { ASSERT(!isPurgeable()); if (!m_script && m_data) { m_script = m_decoder->decode(m_data->data(), encodedSize()); m_script += m_decoder->flush(); setDecodedSize(m_script.length() * sizeof(UChar)); } m_decodedDataDeletionTimer.startOneShot(0); return m_script; } m_decoder->flush() usually returns with an empty string. However, the append duplicates the original string even in this case. (The script can be half mbyte or more). This is an unnecessary allocation and copy.
Attachments
(Platform) String append patch (1.75 KB, patch)
2009-12-04 05:37 PST, Zoltan Herczeg
no flags
Zoltan Herczeg
Comment 1 2009-12-04 05:37:07 PST
Created attachment 44309 [details] (Platform) String append patch
WebKit Review Bot
Comment 2 2009-12-04 05:37:31 PST
style-queue ran check-webkit-style on attachment 44309 [details] without any errors.
WebKit Commit Bot
Comment 3 2009-12-04 12:01:27 PST
Comment on attachment 44309 [details] (Platform) String append patch Clearing flags on attachment: 44309 Committed r51705: <http://trac.webkit.org/changeset/51705>
WebKit Commit Bot
Comment 4 2009-12-04 12:01:36 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.