Re: KIconLoader improvements: icon server
"Aaron J. Seigo" <[email protected]> Tue, 14 Jun 2005 15:43:46 -0600
| Newsgroups | gmane.comp.kde.devel.optimize |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday 14 June 2005 10:31, George Staikos wrote:
> I was wondering about that too. My random guess is that it has to do
> with an algorithmic problem inside the icon server. That's just a guess
> though. :-)
looking through the patch there certainly is room for improvements, which
likely will only show up with larger collections of icons... for instance,
this:
void KIconServer::refIcons( QValueList< QCString > keys_P )
{
if( keys_P.empty())
return;
for( QValueList< QCString >::ConstIterator it = keys_P.begin(); it !=
keys_P.end(); ++it )
{
if( icons.contains( *it ))
{
kdDebug( 179 ) << "increasing refcount: " << *it << endl;
if( icons[ *it ].ref())
--old_icons_count;
continue;
}
kdWarning( 179 ) << "unknown icon in refIcons" << endl;
}
app_ref_deref( kapp->dcopClient()->senderId(), keys_P, true );
}
both contains and operator[] run a find on the red black tree. doing something
like
IconMap::iterator it = icons.find(*it);
if (it != icons.end())
{
if ((*it).ref())
{
--old_icons_count;
}
}
should be more efficient.
app_ref_deref calls KIconAppRef::ref or ::deref .. ::ref can cause a resize of
the array, will do two qheapsorts, and iterates over every key with an inner
loop iterating over the already ref'd keys. so as the number of icons grows,
the time required there will not grow linearly.
i also noticed that while const_iterators are often used, the collection
class's begin() and end() versus constBegin() and constEnd() are used.
there's probably more in there, which is actually pretty good since is already
performs better than cached icons it should be able to go even faster =)
--
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
_______________________________________________
Kde-optimize mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-optimize
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBCr0+a1rcusafx20MRArSxAJ9Blq1xWZSCQMVtmp7KGlhfK+1qMgCfYyVF lT5HHAh0GygyhXRclNnggmg= =fpUf -----END PGP SIGNATURE-----