[Patch] KDirModel fix for non-standard hierarchies

David Faure faure at kde.org
Tue Dec 2 13:05:49 GMT 2008

On Tuesday 02 December 2008, Thiago Macieira wrote:
> On Tuesday 02 December 2008 11:46:44 David Faure wrote:
> > I rewrote qHash(KUrl) and now it's 60 times
> > faster than before...
> Do you mean commit 891419?
> Unfortunately, that change has to wait for KDE 5. That's a behaviour-
> incompatible change. Since qHash(KUrl) is inlined all over the place, code 
> using the old hash will fail to find data inside QHash structures that were 
> created with the new hashing.

Let's be pragmatic. On one hand there's a potential BC breakage for the hypothetical
case of two different modules passing each other a hash of urls (I now grepped and
I couldn't find that anywhere in trunk/KDE nor extragear), on the other hand (in the
current situation) we have:
1) a dead slow hashing of urls (mea culpa)
2) a broken KDirModel for smb://.

Well, 2) can be fixed independently using a KUrlForHash wrapper class that
contains a KUrl or derives from KUrl, that class would be private to KDirModel, 
and it would have the fast qHash(const KUrlForHash&)... but then other users
of QHash<KUrl> (mailody, webarchiver, digikam, okular, gwenview, kio_fonts)
would still be penalized with a very slow hashing function. I'm not talking 2 times
slower, I'm talking 60 times slower. The kind of penalty that makes you regret
using a hash in the first place...

I think KDE can afford to be a bit more pragmatic than Qt about such things.
We don't have paying commercial users of our libs who would complain about binary
compat breakage between two modules that were not recompiled together
(we care for BC between kde modules, that's good, but this change doesn't break that,
in practice). OTOH we have users hitting asserts when they expand smb:/... and 
developers unable to use fancy directory structures in kioslaves, nor fast hashes of urls.
Which population do we care for?

I'm requesting to leave the url-hashing change in and to commit the KDirModel change.

David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list