Bug 195595

Summary: blocksInPreOrder and blocksInPostOrder should reserve the right capacity for their result vector
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: JavaScriptCoreAssignee: Robin Morisset <rmorisset>
Status: RESOLVED FIXED    
Severity: Minor CC: commit-queue, ews-watchlist, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Robin Morisset
Reported 2019-03-11 18:39:14 PDT
Since we know that the result vector will be exactly the size of m_blocks (it is just a permutation). We should also remove the inline capacity of that vector: even most small functions will have more than 5 BB.
Attachments
Patch (2.04 KB, patch)
2019-03-11 18:46 PDT, Robin Morisset
no flags
Robin Morisset
Comment 1 2019-03-11 18:46:06 PDT
Saam Barati
Comment 2 2019-03-11 18:50:29 PDT
Comment on attachment 364332 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364332&action=review > Source/JavaScriptCore/dfg/DFGBasicBlock.h:260 > +typedef Vector<BasicBlock*> BlockList; What’s the motivation here?
Saam Barati
Comment 3 2019-03-11 18:51:23 PDT
(In reply to Robin Morisset from comment #0) > We should also remove the inline capacity of that vector: even most small > functions will have more than 5 BB. Based on what data? This is actually a bit surprising to me
Robin Morisset
Comment 4 2019-03-11 19:07:32 PDT
(In reply to Saam Barati from comment #3) > (In reply to Robin Morisset from comment #0) > > We should also remove the inline capacity of that vector: even most small > > functions will have more than 5 BB. > > Based on what data? This is actually a bit surprising to me I had just observed that while debugging some small test cases. I just tested it on JetStream2. Out of 39158 calls to blocksIn{Pre/Post}Order, only 13676 had 5 or less BasicBlocks. So the current inline capacity is only used in 1/3 of cases, and it otherwise wastes space for no reason. Here are some more numbers in case we really want an inline capacity here for some reason: - 1 BB: 7806 - <= 4 BB: 12129 - <= 8 BB: 17974 - <= 16 BB: 25612 - <= 32 BB: 32558 - <= 34 BB: 37144
Robin Morisset
Comment 5 2019-03-12 10:14:39 PDT
> - <= 34 BB: 37144 This one should have been <= 64 BB of course.
WebKit Commit Bot
Comment 6 2019-03-12 10:42:49 PDT
Comment on attachment 364332 [details] Patch Clearing flags on attachment: 364332 Committed r242802: <https://trac.webkit.org/changeset/242802>
WebKit Commit Bot
Comment 7 2019-03-12 10:42:52 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-03-12 10:43:23 PDT
Note You need to log in before you can comment on or make changes to this bug.