Bug 225732

Summary: Remove StringBuilder::appendNumber
Product: WebKit Reporter: Darin Adler <darin>
Component: Web Template FrameworkAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, andersca, beidson, benjamin, berto, cdumez, cgarcia, changseok, cmarcelo, dino, eric.carlson, esprehn+autocc, ews-watchlist, fmalita, glenn, gustavo, gyuyoung.kim, japhet, jer.noble, jsbell, kangil.han, keith_miller, kondapallykalyan, macpherson, mark.lam, menard, mifenton, msaboff, pdr, philipj, saam, sabouhallawa, sam, schenney, sergio, simon.fraser, toyoshim, tzagallo, webkit-bug-importer, yutak
Priority: P3 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Darin Adler 2021-05-12 21:21:39 PDT
Remove StringBuilder::appendNumber
Comment 1 Darin Adler 2021-05-12 21:41:56 PDT
Created attachment 428458 [details]
Patch
Comment 2 EWS Watchlist 2021-05-12 21:42:46 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Sam Weinig 2021-05-13 08:29:08 PDT
Comment on attachment 428458 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428458&action=review

> Source/WTF/ChangeLog:9
> +        We originally added StringBuilder::appendNumber to resolve the ambiguity
> +        between UChar and uint16_t, but that problem was solved long ago and it

I hadn't realized we had done this otherwise I would have totally done this myself. That's great! Next up should we remove appendLiteral?

> Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:277
> +            String errorMessage = makeString("Failed to load resource: the server responded with a status of ", response.httpStatusCode(), " (", response.httpStatusText(), ')');

I would leave out the String and use auto here.
Comment 4 Darin Adler 2021-05-13 08:48:48 PDT
Comment on attachment 428458 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428458&action=review

>> Source/WTF/ChangeLog:9
>> +        between UChar and uint16_t, but that problem was solved long ago and it
> 
> I hadn't realized we had done this otherwise I would have totally done this myself. That's great! Next up should we remove appendLiteral?

Yes I have been thinking about that. The appendLiteral function does optimization that is not very valuable; it may save some looping over characters to find the string length, and it may be optimizing memory use by using characters in place for the case where only a single literal ends up contributing the entries content of the result string. We could work to keep one or both of these optimizations using ASCIILiteral or a variant on it, for StringBuilder itself and for string concatenation. Or, more likely, we could just forgo both.

I can’t remember why I thought it was worth adding.
Comment 5 Darin Adler 2021-05-13 08:56:10 PDT
entire content, not entries content
Comment 6 EWS 2021-05-13 09:18:42 PDT
Committed r277437 (237685@main): <https://commits.webkit.org/237685@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 428458 [details].
Comment 7 Radar WebKit Bug Importer 2021-05-13 09:19:14 PDT
<rdar://problem/77968469>