Use emptyString() instead of "" when possible to reduce String allocations.
Created attachment 283691 [details] Patch
Comment on attachment 283691 [details] Patch Clearing flags on attachment: 283691 Committed r203250: <http://trac.webkit.org/changeset/203250>
All reviewed patches have been landed. Closing bug.
Does this actually save allocations? String("") does StringImpl::create(LChar*) which does strlen and then StringImpl::create(LChar*, unsigned) which does: https://github.com/adobe/webkit/blob/master/Source/WTF/wtf/text/StringImpl.cpp#L255 if (!characters || !length) return empty(); I think this patch saves branches and function calls, but not allocations?
(In reply to comment #4) > Does this actually save allocations? String("") does > StringImpl::create(LChar*) which does strlen and then > StringImpl::create(LChar*, unsigned) which does: > > https://github.com/adobe/webkit/blob/master/Source/WTF/wtf/text/StringImpl. > cpp#L255 > > if (!characters || !length) > return empty(); > > I think this patch saves branches and function calls, but not allocations? You're totally right Elliot, I did not know about this optimization in StringImpl.