Bug 199462

Summary: [WHLSL] "Semantic" should be held by a unique_ptr, not an Optional
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: WebGPUAssignee: Robin Morisset <rmorisset>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Robin Morisset 2019-07-03 13:48:18 PDT
Most StructureElement, FunctionDeclaration and (especially) VariableDeclaration don't have a 'Semantic' field.
Using an Optional<Semantic> to represent this is a major memory waste, as Semantic is 56 bytes, so Optional<Semantic> is 64 bytes!
Putting one level of indirection through a unique_ptr thus saves 56 bytes for each VariableDeclaration (and FunctionDeclaration and StructureElement) that does not have a Semantic, at the low cost of one pointer dereference when accessing the field for those that have one.
Comment 1 Robin Morisset 2019-07-03 13:51:56 PDT
Created attachment 373413 [details]
Patch
Comment 2 WebKit Commit Bot 2019-07-03 15:11:42 PDT
Comment on attachment 373413 [details]
Patch

Clearing flags on attachment: 373413

Committed r247110: <https://trac.webkit.org/changeset/247110>
Comment 3 WebKit Commit Bot 2019-07-03 15:11:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2019-07-03 15:12:19 PDT
<rdar://problem/52614048>