[Development] Mime database size

Knoll Lars Lars.Knoll at theqtcompany.com
Mon Feb 23 13:00:51 CET 2015



On 22/02/15 19:20, "David Faure" <david.faure at kdab.com> wrote:

>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.

Yes, I still don’t like the fact we’re embedding a 1.7M xml file in Qt
Core at all. I’m not too fond of checking the binary file into the
repositories, but it’s probably still better than continuing with the XML
file.

David, I can’t see how the use case of the app installing additional mime
types is supported today (as there is no API to register additional XML
files or anything like that. So I can’t see how embedding the binary blob
instead of the XML file will give us a feature regression today.
>
>Being able to skip embedding the DB altogether, in whichever form, as
>suggested by Thiago, can help desktop linux distros on top of that.

Yes, that would be a nice feature in any case.

Cheers,
Lars


>
>-- 
>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
>
>_______________________________________________
>Development mailing list
>Development at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list