Use emptyString() instead of String("") because it is better style and faster. This is a followup to r116908, removing all occurrences of String("") from WebKit.
Created attachment 207837 [details] Patch
If we always prefer emptyString() to String(""), why don't we add an assertion to the String constructor to prevent "" from being passed to the constructor?
(In reply to comment #2) > If we always prefer emptyString() to String(""), why don't we add an assertion to the String constructor to prevent "" from being passed to the constructor? We don’t have any reason to allow String(""). But we do want to allow String(x) where x is a variable or argument of type const char* that just happens to be "".
(In reply to comment #0) > Use emptyString() instead of String("") because it is better style and faster. This is a followup to r116908, removing all occurrences of String("") from WebKit. String("") is faster than emptyString() when you need a +1 ref string. emptyString() return a reference, which is then ref()ed on the call site. String("") does pretty much the same thing but ref() on the callee side. This is just for info, I don't mind if this patch lands.
(In reply to comment #4) > String("") is faster than emptyString() when you need a +1 ref string. > > emptyString() return a reference, which is then ref()ed on the call site. String("") does pretty much the same thing but ref() on the callee side. > > This is just for info, I don't mind if this patch lands. Thanks for the info. I think it is good to update the EfficientStrings wiki page.
Committed r153546: <http://trac.webkit.org/changeset/153546>
(In reply to comment #5) > Thanks for the info. I think it is good to update the EfficientStrings wiki page. We can also fix the problem. This https://bugs.webkit.org/show_bug.cgi?id=95793 needs an update.