<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://svn.reviewboard.kde.org/r/5689/">http://svn.reviewboard.kde.org/r/5689/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On October 25th, 2010, 8:03 a.m., <b>Manuel Mommertz</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If you want to use the DOM to find the size hints, you can take a look at KGameSvgDocument. It implements a way to find elements by id. This could should be usable for you.

And can you please measure how long it takes to load the SVG and to look for an element with and without your patch?</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">&gt; And can you please measure how long it takes to load the SVG and to look for an element with and without your patch?

Sure. Obviously, the following is not proper benchmarking, but maybe it can provide at least some insight into the performance implications.

For SharedSvgRenderer:load, I measured the total walltime spent in the method body during the startup of my plasma-desktop session with and without the patch. In both cases, SharedSvgRenderer::load was called 12 times during the startup. I made 5 measurements each and took the median value. 

On both my desktop and my netbook I noticed a slowdown to about 0.75 of the walltime the unpatched version took, which amounted to a median increase in plasma-desktop startup time of ~30 ms on my desktop and ~100 ms on my netbook. I also ran &quot;plasma-desktop --nofork&quot; through callgrind, but the cycle counts did&#39;t seem to relate to the measured walltime at all :/

Measuring SvgPrivate::findInCache is probably hard to do in a meaningful way, since most SVGs don&#39;t use size hinted elements, in which case the impact is a single lookup into an empty hashtable as well as an additional call to createRenderer(). If there are elements with size hints, the search for the best fit scales linearly with the number of size hinted elements with the given base element id. Since even then it doesn&#39;t do very much, this should not really impact performance in any noticeable way. Just for the sake of it, I did a few measurements anyway, but the impact was too minimal to provide meaningful results (createRenderer() and the search for the best of the 6 candidates takes an average of little more than 1 µs when put into a loop, but obviously this has a far better caching behavior than a normal invocation)
</pre>
<br />








<p>- Ingomar</p>


<br />
<p>On October 25th, 2010, 12:17 a.m., Ingomar Wesp wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://svn.reviewboard.kde.orgrb/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 Plasma.</div>
<div>By Ingomar Wesp.</div>


<p style="color: grey;"><i>Updated 2010-10-25 00:17:45</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;">Previously, if an SVG contained size hinted elements, they were only used when the display size matched the size hint exactly. This patch tries to relax this condition by searching for the smallest size hinted element that is still bigger than the display size (in order for the element to be chosen, it also has to have the same aspect ratio). If no such element can be found, it falls back to the normal element id as passed.

In order to speed up the lookup (and because it appears to be impossible to access the DOM of an already loaded SvgRenderer), all size hinted element ids are stored in SharedSvgRenderer at load time.

I think it would be good to change the QRegExp based id fetching into a proper DOM traversal. Are there any convenience functions in KDELibs that allow easy iterating over all elements (couldn&#39;t find any) or do I have to implement that myself based on Qt&#39;s DOM classes?

Please tell me what you think... Have I missed something?</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>/trunk/KDE/kdelibs/plasma/private/svg_p.h <span style="color: grey">(1189389)</span></li>

 <li>/trunk/KDE/kdelibs/plasma/svg.cpp <span style="color: grey">(1189389)</span></li>

</ul>

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




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








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