Bug 222533

Summary: Reduce promise reaction memory usage when there are multiple reactions
Product: WebKit Reporter: Keith Miller <keith_miller>
Component: New BugsAssignee: Keith Miller <keith_miller>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, joepeck, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Keith Miller
Reported 2021-02-28 17:30:27 PST
Reduce promise reaction memory usage when there are multiple reactions
Attachments
Patch (14.88 KB, patch)
2021-02-28 17:33 PST, Keith Miller
no flags
Patch (14.83 KB, patch)
2021-03-01 09:50 PST, Keith Miller
no flags
Patch for landing (14.86 KB, patch)
2021-03-01 16:56 PST, Keith Miller
no flags
Keith Miller
Comment 1 2021-02-28 17:33:10 PST
Keith Miller
Comment 2 2021-03-01 09:50:28 PST
Yusuke Suzuki
Comment 3 2021-03-01 16:15:00 PST
Comment on attachment 421839 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421839&action=review r=me with comment. > Source/JavaScriptCore/ChangeLog:14 > + Previously, we would store each reaction in a linked list. This > + meant each reaction required 8 bytes to point to the next > + reaction. Instead, this patch makes it so the first reaction is > + store inline an object and any additional reactions are store into > + index storage for that object. This doesn't save memory for the > + first reaction since we now need to have a count of all the out of > + line reactions but extra reactions use 8 bytes less each. Does it show RAMification improvement? > Source/JavaScriptCore/builtins/PromiseOperations.js:153 > + var isResolved = state == @promiseStateFulfilled; Use `===` instead of `==`.
Keith Miller
Comment 4 2021-03-01 16:49:42 PST
Comment on attachment 421839 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421839&action=review >> Source/JavaScriptCore/ChangeLog:14 >> + line reactions but extra reactions use 8 bytes less each. > > Does it show RAMification improvement? No, sadly :( >> Source/JavaScriptCore/builtins/PromiseOperations.js:153 >> + var isResolved = state == @promiseStateFulfilled; > > Use `===` instead of `==`. Oof, done!
Keith Miller
Comment 5 2021-03-01 16:56:23 PST
Created attachment 421887 [details] Patch for landing
EWS
Comment 6 2021-03-01 18:14:56 PST
Committed r273718: <https://commits.webkit.org/r273718> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421887 [details].
Radar WebKit Bug Importer
Comment 7 2021-03-01 18:15:16 PST
Note You need to log in before you can comment on or make changes to this bug.