<br><br><div class="gmail_quote">On Tue, Jun 2, 2009 at 7:51 PM, Bart Coppens <span dir="ltr"><<a href="mailto:kde@bartcoppens.be" target="_blank">kde@bartcoppens.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tuesday 02 June 2009 17:25:58 Dmitry Kazakov wrote:<br>
> New commit r976769<br>
(For reference:<br>
<a href="http://websvn.kde.org/branches/work/koffice-feature-tiles-ng/krita/image/tiles3/kis_tile_processors.cc?r1=976769&r2=976768&pathrev=976769" target="_blank">http://websvn.kde.org/branches/work/koffice-intentivelyfeature-tiles-ng/krita/image/tiles3/kis_tile_processors.cc?r1=976769&r2=976768&pathrev=976769</a><br>
<div>)<br>
<br>
> A strange thing! I changed only one line and processors started working 20%<br>
> faster than old system. I don't know why. Could someone take a look.<br>
</div>Well it is probably because you change the meaning of the variable. In the old<br>
version (const qint32 dataIdx), your variable is constant across the duration<br>
of the function. In the new version, (static const qint32 dataIdx) the<br>
variabe is constant for _all_ invocations of the function (after the first<br>
one).<br>
</blockquote></div><br><br>Well... Thanks... I know about storage classes =) And i purposely added 'static' class to ensure that indexFromPoint(m_dataLeftTop, m_dataStride) is called only once while creating processor-object. <br>
The thing i can't understand is how 1multiplication+1addition could cause such a great overhead (0.560sec instead of 0.900sec)?!<br>And more than that, why callgrind causes optimized version to slow down again?<br><br>
Here are three outputs in attachments.<br><br><br clear="all"><br>-- <br>Dmitry Kazakov<br>