From kde-panel-devel Sun Nov 30 23:53:22 2008 From: "Aaron J. Seigo" Date: Sun, 30 Nov 2008 23:53:22 +0000 To: kde-panel-devel Subject: Re: Review Request: Analog clock painting performance Message-Id: <200811301653.28463.aseigo () kde ! org> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=122808924924137 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0515322805==" --===============0515322805== Content-Type: multipart/signed; boundary="nextPart5882109.y0pofkRLse"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart5882109.y0pofkRLse Content-Type: multipart/mixed; boundary="Boundary-01=_zdyMJPU5Kv9IoL9" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_zdyMJPU5Kv9IoL9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday 30 November 2008, you wrote: > > On 2008-11-30 09:01:20, Aaron Seigo wrote: > > > hm. that seems a little suspect to me, but if grabbing the cached rec= ts > > > is really that slow, then Theme::findInRectsCache is probably what > > > needs to be optimized. > > > > > > can you post the cachegrind output somewhere, along with the clock > > > configuration you used? > > It's not that it is very slow, it's that it was called 13 times for each > update. Quite a bit of overhead when you have the m_fancyHands enabled! > > http://aboyer.dyndns.org/kde/callgrind.out.before > http://aboyer.dyndns.org/kde/callgrind.out.after hm .. indeed .. does the attached patch help with this? if so, this would g= et=20 us this optimization for all uses of Plasma::Svg at the cost of a little ex= tra=20 memory overhead. looking at the callgrind output it looks like that the key is to try and av= oid=20 hitting KConfigGroup::readEntry. > >From the comments below, I guess the moral of the story is not to assume > > that the elements are properly positioned in the svg file. These changes > > now become pretty useless. I'll try to reduce the amount of actual > > painting instead of caching the rects. yeah, trying to reduce the painting will be the big win. =2D-=20 Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Software --Boundary-01=_zdyMJPU5Kv9IoL9 Content-Type: text/x-patch; charset="UTF-8"; name="localSvgRectCache.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="localSvgRectCache.diff" Index: svg.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- svg.cpp (revision 890270) +++ svg.cpp (working copy) @@ -233,19 +233,25 @@ } =20 renderer =3D 0; + localRectCache.clear(); } =20 QRectF elementRect(const QString &elementId) { =2D QRectF rect; =2D if (themed && path.isEmpty()) { path =3D Plasma::Theme::defaultTheme()->imagePath(themePat= h); } =20 =2D bool found =3D Theme::defaultTheme()->findInRectsCache(path,= cacheId(elementId), rect); + QString id =3D cacheId(elementId); + if (localRectCache.contains(id)) { + return localRectCache[id]; + } =20 + QRectF rect; + bool found =3D Theme::defaultTheme()->findInRectsCache(path, i= d, rect); + if (found) { + localRectCache.insert(elementId, rect); return rect; } =20 @@ -332,6 +338,7 @@ =20 Svg *q; static QHash s_renderers; + QHash localRectCache; SharedSvgRenderer::Ptr renderer; QString themePath; QString path; @@ -484,10 +491,9 @@ =20 void Svg::setImagePath(const QString &svgFilePath) { =2D if (d->setImagePath(svgFilePath, this)) { =2D } =2D d->eraseRenderer(); =2D emit repaintNeeded(); + d->setImagePath(svgFilePath, this); + d->eraseRenderer(); + emit repaintNeeded(); } =20 QString Svg::imagePath() const --Boundary-01=_zdyMJPU5Kv9IoL9-- --nextPart5882109.y0pofkRLse Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAkkzJ3gACgkQ1rcusafx20PYugCfWKFXMw8I+pODVunwg/dzUv+w c7IAn2XtEYiSJ9AoXXP8omkUybEB84RK =Lf0V -----END PGP SIGNATURE----- --nextPart5882109.y0pofkRLse-- --===============0515322805== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============0515322805==--