Should fast mime detection use a stat call?

Frank Reininghaus frank78ac at
Mon Jun 17 10:06:59 BST 2013

Hi Mark,

thanks for looking into these issues. Enabling us to load icons faster
when entering a directory is appreciated :-)

I can't say much about your proposed changes in kdelibs though - I
think that David will be able to give more useful comments.

2013/6/17 Mark:
> What's your opinion on this? My intention is to have fast mime lookup
> be really fast and don't do any stat calls at all which is the patch
> in [1]. Stat calls even seem like a waste because you are very likely
> to have just done a stat call just to get the file list. However, that
> stat data isn't send to KMimeType so another way would be to require a
> "KFileItem" which knows more about a file instead of a KUrl (QUrl in
> kde frameworks). But then again, that requires app side changes...

AFAIK, KFileItem does know if the file it's referring to is a
directory. If there is indeed another stat call in KMimeType just to
find out if it's a directory or a file, there might be a away to avoid
that (but I think that we should make sure that existing code that
relies on the stat doesn't break).

Another thing to consider is that the frameworks version of KFileItem
does not use KMimeType any more:

So I'm not sure how much of all this still applies to frameworks.


More information about the kde-core-devel mailing list