Bug 239021

Summary: Avoid redundant calls to findHTTPHeaderName()
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, darin, ews-watchlist, ggaren, toyoshim, webkit-bug-importer, youennf, yutak
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2022-04-08 16:35:06 PDT
Avoid redundant calls to findHTTPHeaderName().
Comment 1 Chris Dumez 2022-04-08 16:41:06 PDT
Created attachment 457127 [details]
Patch
Comment 2 Darin Adler 2022-04-10 15:46:11 PDT
Comment on attachment 457127 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        Avoid redundant calls to findHTTPHeaderName()

Can some of this be changed to use StringView later?
Comment 3 Chris Dumez 2022-04-10 16:03:14 PDT
(In reply to Darin Adler from comment #2)
> Comment on attachment 457127 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=457127&action=review
> 
> > Source/WebCore/ChangeLog:3
> > +        Avoid redundant calls to findHTTPHeaderName()
> 
> Can some of this be changed to use StringView later?

What part? findHTTPHeaderName() already takes a Stringview:
Source/WebCore/platform/network/create-http-header-name-table:bool findHTTPHeaderName(StringView stringView, HTTPHeaderName& headerName)
Comment 4 EWS 2022-04-10 16:55:41 PDT
Committed r292692 (249484@main): <https://commits.webkit.org/249484@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457127 [details].
Comment 5 Radar WebKit Bug Importer 2022-04-10 17:03:58 PDT
<rdar://problem/91540482>
Comment 6 Darin Adler 2022-04-11 08:34:00 PDT
Comment on attachment 457127 [details]
Patch

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

>>> Source/WebCore/ChangeLog:3
>>> +        Avoid redundant calls to findHTTPHeaderName()
>> 
>> Can some of this be changed to use StringView later?
> 
> What part? findHTTPHeaderName() already takes a Stringview:
> Source/WebCore/platform/network/create-http-header-name-table:bool findHTTPHeaderName(StringView stringView, HTTPHeaderName& headerName)

For example, setHTTPHeaderField and addHTTPHeaderField. It requires making arguments into String if they aren’t known HTTP header names, but do those String objects get kept around? It’s good we don’t do it with string literals, but what about other sources of strings? And what about the value? Does it get stored as a String or some other way? I think there are still extra String involved in those functions.