<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/119539/">https://git.reviewboard.kde.org/r/119539/</a>
     </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">looks good, just for the future, don't forget to run benchmarks multiple times, i.e. use perf stat -r 10 or similar.</p></pre>
 <br />







<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://git.reviewboard.kde.org/r/119539/diff/1/?file=294405#file294405line520" style="color: black; font-weight: bold; text-decoration: underline;">duchain/tuduchain.h</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void setDeclInCtxtData(CXCursor cursor, FunctionDefinition *def)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">519</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">auto</span> <span class="n">decl</span> <span class="o">=</span> <span class="n"><span class="hl">ClangHelpers</span></span><span class="o"><span class="hl">::</span></span><span class="n">findDeclaration</span><span class="p">(</span><span class="n">canon</span><span class="p"><span class="hl">,</span></span><span class="hl"> </span><span class="n"><span class="hl">m_includes</span></span><span class="p">))</span> <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">520</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">auto</span> <span class="n">decl</span> <span class="o">=</span> <span class="n">findDeclaration</span><span class="p">(</span><span class="n">canon</span><span class="p">))</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">unrelated, but please change while at it: this should be on the line above</p></pre>
 </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://git.reviewboard.kde.org/r/119539/diff/1/?file=294405#file294405line581" style="color: black; font-weight: bold; text-decoration: underline;">duchain/tuduchain.h</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">private:</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">581</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">QHash</span><span class="o"><</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">,</span> <span class="n">Declaration</span><span class="o">*></span> <span class="n">m_cursorToDeclarationCache</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">can you make sure that the declarations found here are never invalidated while parsing? i.e. if you find declarations from an imported file and that one gets parsed as well and the decl removed - couldn't that lead to crashes here? the declpointer would be safer, no?</p></pre>
 </div>
</div>
<br />



<p>- Milian Wolff</p>


<br />
<p>On July 30th, 2014, midnight UTC, Kevin Funk wrote:</p>









<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for KDevelop.</div>
<div>By Kevin Funk.</div>


<p style="color: grey;"><i>Updated July 30, 2014, midnight</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdev-clang
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Improve use-building timings</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Please check: The biggest bottle-neck at the moment is<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
ClangHelpers::findDeclaration which in turn is calling<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
DUContext::findContextAt millions of times for the 'benchDUChainBuilder'<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
bench mark.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Avoid retrieving the declaration of a cursor by caching the mapping of<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
those.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">For this particular benchmark, I get an improvment of around 15% in both<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
execution time and instruction cost on my machine.</p></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With lookup table (with patch applied):<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
 Performance counter stats for './tests/test_duchain benchDUChainBuilder':</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">   <span style="color: #666666">3473.206422</span> task<span style="color: #666666">-</span>clock (msec)         <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.985</span> CPUs utilized          
         <span style="color: #666666">2</span>,<span style="color: #666666">092</span> context<span style="color: #666666">-</span>switches          <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.602</span> K<span style="color: #666666">/</span>sec                  
            <span style="color: #666666">75</span> cpu<span style="color: #666666">-</span>migrations            <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.022</span> K<span style="color: #666666">/</span>sec                  
        <span style="color: #666666">51</span>,<span style="color: #666666">985</span> page<span style="color: #666666">-</span>faults               <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.015</span> M<span style="color: #666666">/</span>sec                  
<span style="color: #666666">10</span>,<span style="color: #666666">578</span>,<span style="color: #666666">241</span>,<span style="color: #666666">754</span> cycles                    <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">3.046</span> GHz                     [<span style="color: #666666">83.40%</span>]
 <span style="color: #666666">7</span>,<span style="color: #666666">245</span>,<span style="color: #666666">909</span>,<span style="color: #666666">645</span> stalled<span style="color: #666666">-</span>cycles<span style="color: #666666">-</span>frontend   <span style="border: 1px solid #FF0000">#</span>   <span style="color: #666666">68.50%</span> frontend cycles idle    [<span style="color: #666666">83.43%</span>]
 <span style="color: #666666">5</span>,<span style="color: #666666">227</span>,<span style="color: #666666">389</span>,<span style="color: #666666">732</span> stalled<span style="color: #666666">-</span>cycles<span style="color: #666666">-</span>backend    <span style="border: 1px solid #FF0000">#</span>   <span style="color: #666666">49.42%</span> backend  cycles idle    [<span style="color: #666666">67.17%</span>]
 <span style="color: #666666">6</span>,<span style="color: #666666">864</span>,<span style="color: #666666">182</span>,<span style="color: #666666">162</span> instructions              <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.65</span>  insns per cycle        
                                         <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">1.06</span>  stalled cycles per insn [<span style="color: #666666">83.58%</span>]
 <span style="color: #666666">1</span>,<span style="color: #666666">470</span>,<span style="color: #666666">329</span>,<span style="color: #666666">373</span> branches                  <span style="border: 1px solid #FF0000">#</span>  <span style="color: #666666">423.335</span> M<span style="color: #666666">/</span>sec                   [<span style="color: #666666">83.05%</span>]
    <span style="color: #666666">41</span>,<span style="color: #666666">255</span>,<span style="color: #666666">774</span> branch<span style="color: #666666">-</span>misses             <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">2.81%</span> of all branches         [<span style="color: #666666">83.18%</span>]

   <span style="color: #666666">3.525325050</span> seconds time elapsed
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Without lookup table (old version):<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
 Performance counter stats for './tests/test_duchain benchDUChainBuilder':</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">   <span style="color: #666666">3931.375198</span> task<span style="color: #666666">-</span>clock (msec)         <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.989</span> CPUs utilized          
         <span style="color: #666666">2</span>,<span style="color: #666666">133</span> context<span style="color: #666666">-</span>switches          <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.543</span> K<span style="color: #666666">/</span>sec                  
            <span style="color: #666666">90</span> cpu<span style="color: #666666">-</span>migrations            <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.023</span> K<span style="color: #666666">/</span>sec                  
        <span style="color: #666666">52</span>,<span style="color: #666666">642</span> page<span style="color: #666666">-</span>faults               <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.013</span> M<span style="color: #666666">/</span>sec                  
<span style="color: #666666">11</span>,<span style="color: #666666">969</span>,<span style="color: #666666">396</span>,<span style="color: #666666">458</span> cycles                    <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">3.045</span> GHz                     [<span style="color: #666666">82.66%</span>]
 <span style="color: #666666">7</span>,<span style="color: #666666">977</span>,<span style="color: #666666">592</span>,<span style="color: #666666">042</span> stalled<span style="color: #666666">-</span>cycles<span style="color: #666666">-</span>frontend   <span style="border: 1px solid #FF0000">#</span>   <span style="color: #666666">66.65%</span> frontend cycles idle    [<span style="color: #666666">83.47%</span>]
 <span style="color: #666666">5</span>,<span style="color: #666666">803</span>,<span style="color: #666666">405</span>,<span style="color: #666666">467</span> stalled<span style="color: #666666">-</span>cycles<span style="color: #666666">-</span>backend    <span style="border: 1px solid #FF0000">#</span>   <span style="color: #666666">48.49%</span> backend  cycles idle    [<span style="color: #666666">67.01%</span>]
 <span style="color: #666666">8</span>,<span style="color: #666666">269</span>,<span style="color: #666666">772</span>,<span style="color: #666666">450</span> instructions              <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.69</span>  insns per cycle        
                                         <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">0.96</span>  stalled cycles per insn [<span style="color: #666666">83.55%</span>]
 <span style="color: #666666">1</span>,<span style="color: #666666">862</span>,<span style="color: #666666">975</span>,<span style="color: #666666">997</span> branches                  <span style="border: 1px solid #FF0000">#</span>  <span style="color: #666666">473.874</span> M<span style="color: #666666">/</span>sec                   [<span style="color: #666666">83.40%</span>]
    <span style="color: #666666">43</span>,<span style="color: #666666">136</span>,<span style="color: #666666">480</span> branch<span style="color: #666666">-</span>misses             <span style="border: 1px solid #FF0000">#</span>    <span style="color: #666666">2.32%</span> of all branches         [<span style="color: #666666">83.71%</span>]

   <span style="color: #666666">3.976143471</span> seconds time elapsed
</pre></div>
</p></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>duchain/tuduchain.h <span style="color: grey">(2021c6da8197b6c5ebfc67ca7d63cabdd7968e52)</span></li>

 <li>duchain/tuduchain.cpp <span style="color: grey">(5e819b2530b2748364b4db488c388a63181167ce)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/119539/diff/" style="margin-left: 3em;">View Diff</a></p>






  </td>
 </tr>
</table>








  </div>
 </body>
</html>