Bug 312803
| Summary: | API::PageConfiguration::Data::LazyInitializedRef wastefully initializes unneeded objects | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> |
| Component: | New Bugs | Assignee: | Brent Fulgham <bfulgham> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brent Fulgham
The copy assignment operator for Data::LazyInitializedRef (APIPageConfiguration.h (Line 504:)) triggers an initialization by calling `get()` on the source object:
void operator=(const LazyInitializedRef& other) { m_value = other.get(); }
This triggers lazy initialization on the source `m_value` for ANY uninitialized member.
During `copyDataFrom`, the Data struct's generated copy assignment calls this for ALL 5 LazyInitializedRef members. For members NOT explicitly set on the source (e.g., visitedLinkStore, defaultWebsitePolicies), this causes us to create throw-away objects as a side-effect of copying.
While this doesn't create any user-facing bug, it does involve allocating/deallocating up to 5 objects for each copy (e.g., during IPC) which uses power and costs us performance.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/175189199>
Brent Fulgham
Pull request: https://github.com/WebKit/WebKit/pull/63153
EWS
Committed 312140@main (f84460ba474e): <https://commits.webkit.org/312140@main>
Reviewed commits have been landed. Closing PR #63153 and removing active labels.