Bug 229834 - Improve performance by using StringView, not "const StringView&"
Summary: Improve performance by using StringView, not "const StringView&"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-02 15:30 PDT by Darin Adler
Modified: 2021-09-09 16:39 PDT (History)
29 users (show)

See Also:


Attachments
Patch (45.13 KB, patch)
2021-09-02 15:34 PDT, Darin Adler
andersca: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (46.67 KB, patch)
2021-09-03 14:36 PDT, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2021-09-02 15:30:03 PDT
Improve performance by using StringView, not "const StringView&"
Comment 1 Darin Adler 2021-09-02 15:34:00 PDT
Created attachment 437204 [details]
Patch
Comment 2 Myles C. Maxfield 2021-09-02 21:55:16 PDT
Comment on attachment 437204 [details]
Patch

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

> Source/WTF/ChangeLog:11
> +        Since StringView is a small structure that fits into two registers, it's not
> +        good to pass a pointer to it; better performance to pass it by value. Note
> +        that this is for release builds, not debug builds where StringView has
> +        significant additional overhead when copying.

Was there a measurable performance improvement by doing this?
Comment 3 Darin Adler 2021-09-03 13:59:17 PDT
Comment on attachment 437204 [details]
Patch

Need a new version of this patch; the iterator part of it is wrong for debug builds.
Comment 4 Darin Adler 2021-09-03 14:05:53 PDT
Comment on attachment 437204 [details]
Patch

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

>> Source/WTF/ChangeLog:11
>> +        significant additional overhead when copying.
> 
> Was there a measurable performance improvement by doing this?

I do not expect improvement to be measurable except in a micro-benchmark.

As with any change, it’s important to double check we don’t measure a slowdown in any of our larger scale benchmarks, and I tried a couple locally and saw no difference.
Comment 5 Darin Adler 2021-09-03 14:36:34 PDT
Created attachment 437312 [details]
Patch
Comment 6 Radar WebKit Bug Importer 2021-09-09 15:30:22 PDT
<rdar://problem/82946272>
Comment 7 EWS 2021-09-09 16:39:47 PDT
Committed r282242 (241525@main): <https://commits.webkit.org/241525@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 437312 [details].