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








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 31st, 2011, 5:52 p.m., <b>Rolf Eike Beer</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<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="http://git.reviewboard.kde.org/r/102165/diff/1/?file=30480#file30480line941" style="color: black; font-weight: bold; text-decoration: underline;">kdecore/text/kcodecs.cpp</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 KMD5::reset()</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">941</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">quint32</span> <span class="n">a</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">b</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">c</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">d</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">3</span><span class="p">]<span class="hl">,</span></span><span class="hl"> </span><span class="n"><span class="hl">x</span></span><span class="p"><span class="hl">[</span></span><span class="mi"><span class="hl">16</span></span><span class="p"><span class="hl">]</span>;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">939</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span class="hl"> </span><span class="k"><span class="hl">register</span></span> <span class="n">quint32</span> <span class="n">a</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">b</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">c</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">d</span> <span class="o">=</span> <span class="n">m_state</span><span class="p">[</span><span class="mi">3</span><span class="p">];</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Please remove this register keyword. In best case the compiler moves this value into a register where he had placed it anyway. But usually you force a value into a register that the compiler could use for something better.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The register keyword is the key of the patch.
Without it, the times are almost the same as without the patch (little less probably because of the removal of memset).

The totals for transform are: 91,13% without the patch and 61,97% with it (only 4/3 times faster), and 85,19% without register.

g++ is not yet smart enough.</pre>
<br />




<p>- Jaime Torres</p>


<br />
<p>On July 31st, 2011, 5:28 p.m., Jaime Torres Amate wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for kdelibs.</div>
<div>By Jaime Torres Amate.</div>


<p style="color: grey;"><i>Updated July 31, 2011, 5:28 p.m.</i></p>




<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;">I think the private methods can be changed without chaning the binary interface..
In that case, I've changed some kmd5 methods to make them const, and pass const numbers.
Also, in the transform method I've added register to the a,b,c,d variables, changing the FF, GG, HH ad II to return qint32 (hopefully in a register also).

In any case, the memset at the end of transform can be avoided. 
There is also a little change to not declare and inicialize and never use a variable in quotedprintable.</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;">Running kphotoalbum maintenance|Recalculate checksum, that makes extensive use of kmd5, under callgrind, it shows that the new version is faster.
At least in an AMD64.
In the old way, FF, GG, HH and II calls in the transform method took 1,10%; 1,07%; 1,00%; 1,03%  +0,33% passing parameters
In the new way, FF, GG, HH and II calls in the transform method take 0,83%; 0,80%; 0,76%; 0,78%  +0,21% passing parameters

I've tried also the kmd5benchmarktest, but I do not understand very well the results (or if they are as accurate as callgrind).</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>kdecore/text/kcodecs.h <span style="color: grey">(023a129)</span></li>

 <li>kdecore/text/kcodecs.cpp <span style="color: grey">(ce0e48d)</span></li>

</ul>

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




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








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