Bug 230933

Summary: Reduce allocations in DatabaseUtilities::sortedTables
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Alex Christensen 2021-09-28 20:12:50 PDT
Reduce allocations in DatabaseUtilities::sortedTables
Comment 1 Alex Christensen 2021-09-28 20:13:52 PDT
Created attachment 439561 [details]
Patch
Comment 2 Chris Dumez 2021-09-28 20:21:49 PDT
Comment on attachment 439561 [details]
Patch

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

> Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:276
> +Span<const ASCIILiteral> ResourceLoadStatisticsDatabaseStore::sortedTables()

Why return a span and not a const std::array<ASCIILiteral>& ?
Comment 3 Alex Christensen 2021-09-28 22:00:50 PDT
Because they have different sizes.  std::array has a template parameter that is its size, so they would return different types.
Comment 4 EWS 2021-09-29 09:28:55 PDT
Committed r283227 (242269@main): <https://commits.webkit.org/242269@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439561 [details].
Comment 5 Radar WebKit Bug Importer 2021-09-29 09:29:20 PDT
<rdar://problem/83674449>
Comment 6 Darin Adler 2021-10-01 16:12:43 PDT
Comment on attachment 439561 [details]
Patch

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

> Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:116
> +    static std::array sortedTables {

Why not constexpr?
Comment 7 Alex Christensen 2021-10-01 16:15:08 PDT
Comment on attachment 439561 [details]
Patch

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

>> Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:116
>> +    static std::array sortedTables {
> 
> Why not constexpr?

indeed.  That could be added.  I missed that.