Log Message
Lazily allocate HistoricUsageData https://bugs.webkit.org/show_bug.cgi?id=212878
Reviewed by Saam Barati. This is only used when resource-overlay is enabled. We should allocate it lazily instead of putting this in __DATA. This also reduces binary size by 19KB. * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::historicUsageData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (287237 => 287238)
--- trunk/Source/WebCore/ChangeLog 2021-12-19 08:43:55 UTC (rev 287237)
+++ trunk/Source/WebCore/ChangeLog 2021-12-19 09:40:48 UTC (rev 287238)
@@ -1,3 +1,16 @@
+2021-12-19 Yusuke Suzuki <[email protected]>
+
+ Lazily allocate HistoricUsageData
+ https://bugs.webkit.org/show_bug.cgi?id=212878
+
+ Reviewed by Saam Barati.
+
+ This is only used when resource-overlay is enabled. We should allocate it lazily instead of putting this in __DATA.
+ This also reduces binary size by 19KB.
+
+ * page/cocoa/ResourceUsageOverlayCocoa.mm:
+ (WebCore::historicUsageData):
+
2021-12-18 Darin Adler <[email protected]>
Hash tables, read/write, and heap memory are used unnecessarily, which may hurt performance
Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (287237 => 287238)
--- trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2021-12-19 08:43:55 UTC (rev 287237)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2021-12-19 09:40:48 UTC (rev 287238)
@@ -146,6 +146,7 @@
};
struct HistoricResourceUsageData {
+ WTF_MAKE_STRUCT_FAST_ALLOCATED;
HistoricResourceUsageData();
RingBuffer<float> cpu;
@@ -184,8 +185,12 @@
static HistoricResourceUsageData& historicUsageData()
{
- static NeverDestroyed<HistoricResourceUsageData> data;
- return data;
+ static HistoricResourceUsageData* data { nullptr };
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ data = "" HistoricResourceUsageData;
+ });
+ return *data;
}
static void appendDataToHistory(const ResourceUsageData& data)
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
