[Thunar-dev] reducing stat()'s and fread's

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Sat Jun 4 15:42:49 CEST 2005


Wit Wilinski wrote:
> On Sat, 04 Jun 2005 15:05:23 +0200
> Benedikt Meurer <benedikt.meurer at unix-ag.uni-siegen.de> wrote:
> 
>>The shared mime database spec mentions that an implementation MAY query 
>>the MIME type from an extended attribute:
>>
>>http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.13.html#id2506422
>>
>>This can be supported, but since most file systems don't support 
>>extended attributes (and those that do, differ in implementations across 
>>operating systems), it is on low priority. In addition, this requires 
> 
> I know it's not well supported, currently. Although I think that it may be the way to optimizing mime type detection in the future. The first and most important thing would be a good fallback system (eg. for processing files on fat32 filesystems).
> Determining file's type by extension is IMHO out of the question. It's too primitive and files might have different extension than their contents...

We're going to implement the Shared MIME Database spec, so the 
"fallback" is well defined:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.13.html#id2447161

Detecting the MIME type will be the common case for a very, very long 
time, until (a) all file systems support extattrs and (b) all 
applications set the MIME type when saving files.

The problem with focussing on extattrs for optimization won't work. 
Optimizations will only work if you optimize for the common case, which 
is that there's no extattr available or not set properly.

We've already collected ideas to speedup the MIME detection at 
http://thunar.xfce.org/wiki/design:mime-system (and related pages).

greets,
Benedikt



More information about the Thunar-dev mailing list