Bug 239021 - Avoid redundant calls to findHTTPHeaderName()
Summary: Avoid redundant calls to findHTTPHeaderName()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-08 16:35 PDT by Chris Dumez
Modified: 2022-04-11 08:34 PDT (History)
8 users (show)

See Also:


Attachments
Patch (11.88 KB, patch)
2022-04-08 16:41 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.