<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>195595</bug_id>
          
          <creation_ts>2019-03-11 18:39:14 -0700</creation_ts>
          <short_desc>blocksInPreOrder and blocksInPostOrder should reserve the right capacity for their result vector</short_desc>
          <delta_ts>2019-03-12 10:43:23 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robin Morisset">rmorisset</reporter>
          <assigned_to name="Robin Morisset">rmorisset</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1515172</commentid>
    <comment_count>0</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-03-11 18:39:14 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515174</commentid>
    <comment_count>1</comment_count>
      <attachid>364332</attachid>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-03-11 18:46:06 -0700</bug_when>
    <thetext>Created attachment 364332
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515175</commentid>
    <comment_count>2</comment_count>
      <attachid>364332</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-03-11 18:50:29 -0700</bug_when>
    <thetext>Comment on attachment 364332
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=364332&amp;action=review

&gt; Source/JavaScriptCore/dfg/DFGBasicBlock.h:260
&gt; +typedef Vector&lt;BasicBlock*&gt; BlockList;

What’s the motivation here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515176</commentid>
    <comment_count>3</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-03-11 18:51:23 -0700</bug_when>
    <thetext>(In reply to Robin Morisset from comment #0)
&gt; We should also remove the inline capacity of that vector: even most small
&gt; functions will have more than 5 BB.

Based on what data? This is actually a bit surprising to me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515188</commentid>
    <comment_count>4</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-03-11 19:07:32 -0700</bug_when>
    <thetext>(In reply to Saam Barati from comment #3)
&gt; (In reply to Robin Morisset from comment #0)
&gt; &gt; We should also remove the inline capacity of that vector: even most small
&gt; &gt; functions will have more than 5 BB.
&gt; 
&gt; 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
- &lt;= 4 BB: 12129
- &lt;= 8 BB: 17974
- &lt;= 16 BB: 25612
- &lt;= 32 BB: 32558
- &lt;= 34 BB: 37144</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515487</commentid>
    <comment_count>5</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-03-12 10:14:39 -0700</bug_when>
    <thetext>&gt; - &lt;= 34 BB: 37144

This one should have been &lt;= 64 BB of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515501</commentid>
    <comment_count>6</comment_count>
      <attachid>364332</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-03-12 10:42:49 -0700</bug_when>
    <thetext>Comment on attachment 364332
Patch

Clearing flags on attachment: 364332

Committed r242802: &lt;https://trac.webkit.org/changeset/242802&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515502</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-03-12 10:42:52 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515504</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-03-12 10:43:23 -0700</bug_when>
    <thetext>&lt;rdar://problem/48813529&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>364332</attachid>
            <date>2019-03-11 18:46:06 -0700</date>
            <delta_ts>2019-03-12 10:42:49 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>patch195595</filename>
            <type>text/plain</type>
            <size>2091</size>
            <attacher name="Robin Morisset">rmorisset</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMjQyNzYxKQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW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EAgLTkyNiw2
ICs5MjcsNyBAQAogQmxvY2tMaXN0IEdyYXBoOjpibG9ja3NJblBvc3RPcmRlcihib29sIGlzU2Fm
ZVRvVmFsaWRhdGUpCiB7CiAgICAgQmxvY2tMaXN0IHJlc3VsdDsKKyAgICByZXN1bHQucmVzZXJ2
ZUluaXRpYWxDYXBhY2l0eShtX2Jsb2Nrcy5zaXplKCkpOwogICAgIFBvc3RPcmRlckJsb2NrV29y
a2xpc3Qgd29ya2xpc3Q7CiAgICAgZm9yIChCYXNpY0Jsb2NrKiBlbnRyeXBvaW50IDogbV9yb290
cykKICAgICAgICAgd29ya2xpc3QucHVzaChlbnRyeXBvaW50KTsK
</data>

          </attachment>
      

    </bug>

</bugzilla>