RESOLVED FIXED 226982
Reduce sizeof(NetworkLoadMetrics)
https://bugs.webkit.org/show_bug.cgi?id=226982
Summary Reduce sizeof(NetworkLoadMetrics)
Alex Christensen
Reported 2021-06-14 12:02:33 PDT
Use bit fields to reduce sizeof(SecurityOrigin) and sizeof(NetworkLoadMetrics)
Attachments
Patch (12.31 KB, patch)
2021-06-14 12:05 PDT, Alex Christensen
no flags
Patch (50.64 KB, patch)
2021-08-19 17:12 PDT, Alex Christensen
ews-feeder: commit-queue-
Patch including soup implementation (55.64 KB, patch)
2021-08-20 02:33 PDT, Carlos Garcia Campos
no flags
Patch (60.40 KB, patch)
2021-08-24 18:02 PDT, Fujii Hironori
no flags
Patch (60.86 KB, patch)
2021-08-24 19:26 PDT, Fujii Hironori
no flags
Patch (63.55 KB, patch)
2021-08-31 16:44 PDT, Alex Christensen
no flags
Patch (64.34 KB, patch)
2021-09-21 16:22 PDT, Alex Christensen
no flags
Alex Christensen
Comment 1 2021-06-14 12:05:46 PDT
Chris Dumez
Comment 2 2021-06-14 12:11:08 PDT
Comment on attachment 431351 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431351&action=review > Source/WebCore/ChangeLog:3 > + Use bit fields to reduce sizeof(SecurityOrigin) and sizeof(NetworkLoadMetrics) Why? Do we keep a lot of SecurityOrigins in memory? I did not expect us to. I don't think we should use bitfields unless there is a strong argument to reduce memory usage, given that it makes the code less readable/convenient.
Radar WebKit Bug Importer
Comment 3 2021-06-21 12:03:46 PDT
Alex Christensen
Comment 4 2021-08-19 17:12:36 PDT
Carlos Garcia Campos
Comment 5 2021-08-20 02:33:28 PDT
Created attachment 435959 [details] Patch including soup implementation It also fixes a couple of redundant move in return statement issues.
Fujii Hironori
Comment 6 2021-08-24 18:02:33 PDT
Fujii Hironori
Comment 7 2021-08-24 19:26:20 PDT
Alex Christensen
Comment 8 2021-08-31 16:44:43 PDT
Alex Christensen
Comment 9 2021-09-01 12:26:10 PDT
After r281860 this needs rebasing which will add another use of emptyMetrics, but please review.
Don Olmstead
Comment 10 2021-09-01 17:44:22 PDT
The cURL side looks fine from our side.
Chris Dumez
Comment 11 2021-09-21 15:38:48 PDT
Comment on attachment 436964 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=436964&action=review r=me with changes > Source/WebCore/platform/network/NetworkLoadMetrics.h:67 > + NetworkLoadMetrics(const NetworkLoadMetrics&) = default; Why do we need these? What prevents the fault ones from being generated? > Source/WebCore/platform/network/NetworkLoadMetrics.h:116 > +struct AdditionalNetworkLoadMetricsForWebInspector : public RefCounted<AdditionalNetworkLoadMetricsForWebInspector> { Given that this subclasses RefCounted, we should make the constructor private and have a public create() function. It is too error-prone otherwise. Alternatively, looking at your patch, I don't think we need to subclass RefCounted at all as it doesn't seem we ever share ownership of such objects? If so, I would just not subclass RefCounted and use makeUnique / unique_ptr.
Alex Christensen
Comment 12 2021-09-21 15:49:36 PDT
(In reply to Chris Dumez from comment #11) > Comment on attachment 436964 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=436964&action=review > > r=me with changes > > > Source/WebCore/platform/network/NetworkLoadMetrics.h:67 > > + NetworkLoadMetrics(const NetworkLoadMetrics&) = default; > > Why do we need these? What prevents the fault ones from being generated? I tried to remove the copy constructor in an earlier version of the patch, and I think this change isn't necessary now. Will remove. > > Source/WebCore/platform/network/NetworkLoadMetrics.h:116 > > +struct AdditionalNetworkLoadMetricsForWebInspector : public RefCounted<AdditionalNetworkLoadMetricsForWebInspector> { > > Given that this subclasses RefCounted, we should make the constructor > private and have a public create() function. It is too error-prone otherwise. > > Alternatively, looking at your patch, I don't think we need to subclass > RefCounted at all as it doesn't seem we ever share ownership of such > objects? If so, I would just not subclass RefCounted and use makeUnique / > unique_ptr. The copy constructor copies a reference. It would be an unnecessary copy if it were a unique_ptr.
Alex Christensen
Comment 13 2021-09-21 16:22:26 PDT
EWS
Comment 14 2021-09-21 17:27:31 PDT
Committed r282853 (241984@main): <https://commits.webkit.org/241984@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 438882 [details].
Note You need to log in before you can comment on or make changes to this bug.