[Development] Mime database size

David Faure david.faure at kdab.com
Sun Feb 22 19:20:54 CET 2015


On Thursday 19 February 2015 01:55:01 Kevin Kofler wrote:
> Arnaud Vrac wrote:
> > Commit fbeeaf2 in qtbase adds QT_NO_MIMETYPE:
> > 
> > "The mime type stuff generates one of the biggest translation units in
> > QtCore due to the compressed 1.7MB freedesktop.org.xml resource. With
> > QT_NO_MIMETYPE, libQt5Core.so is almost 400Kb smaller (4.8MB->4.4MB gcc
> > 4.9 stripped release build)"
> > 
> > It would be nice to be able to find a middle ground between disabling the
> > mime database completely and adding 1.7MB of data to Qt. The
> > update-mime-database binary from the shared-mime-info package can generate
> > a binary file from the XML, which is 100KB large and still allows finding
> > the mimetype of any file. The only difference with the XML is that you
> > don't have the translated pretty string for the mime type. The binary file
> > can also be mmapped and used for every request very efficiently, instead
> > of allocating all mime types data in memory.
> 
> This won't help the other platforms, but on GNU/Linux, can't we just use the
> system shared-mime-info database?

We do.

The builtin XML is for the case where it's not available (Windows/Mac) or not 
found (reduced Linux system, e.g. some embedded linux systems).

Lars suggested long ago that we put the binary instead in QtCore (like 
Giuseppe just did). This would be good for performance too - parsing this XML 
is a horrible performance penalty. The reason I didn't do that yet is that on 
systems without update-mime-database we still need to be able to parse XML 
files (e.g. for additional mimetypes installed by applications), so the 
current design (XML *or* binary backend) doesn't work for that, we need a way 
to use both.

Being able to skip embedding the DB altogether, in whichever form, as 
suggested by Thiago, can help desktop linux distros on top of that.

-- 
David Faure | david.faure at kdab.com | Managing Director KDAB France
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.fr
KDAB - Qt Experts - Platform-independent software solutions




More information about the Development mailing list