Should fast mime detection use a stat call?

Mark markg85 at
Mon Jun 17 10:39:23 BST 2013

On Mon, Jun 17, 2013 at 11:06 AM, Frank Reininghaus
<frank78ac at> wrote:
> 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.

Ahh no! That means i have to redo my benchmarking only against
QMimeType. Darn, i should have looked at KMimeType usage before
starting this speedup. Oh well, perhaps i can apply the same speedup
in QMimeType :)
> Regards,
> Frank

More information about the kde-core-devel mailing list