[Interest] Size of libQt5Core in 5.3

Peter Kuemmel syntheticpp at gmx.net
Wed May 14 10:48:02 CEST 2014


> Von: "Daniel Bowen" <qtmailinglist1 at bowensite.com>
> An: interest at qt-project.org
> Betreff: Re: [Interest] Size of libQt5Core in 5.3
>
> Thanks again for the info.
> 
> Here's where I've gotten to so far.
> 
> Starting from the last ./configure command line I mentioned, plus
> -no-feature- for every qfeature.txt item (minus LIBRARY, SETTINGS and
> REGULAREXPRESSION, since it doesn't build without those), I was at 4.3 MB
> stripped.
> 
> Added to the size:
> 1. From the "-no-feature- for every feature" list, I pulled out a few more
> of the -no-feature- things for features we need directly or indirectly.  So,
> these things are not specified to ./configure anymore (and so the feature is
> included).
> 	(removed -no-feature-LIBRARY -no-feature-SETTINGS
> -no-feature-REGULAREXPRESSION earlier)
> 	-no-feature-XMLSTREAM -no-feature-XMLSTREAMREADER
> -no-feature-XMLSTREAMWRITER -no-feature-TEMPORARYFILE -no-feature-TEXTDATE
> -no-feature-DATESTRING -no-feature-PROPERTIES -no-feature-TEXTCODEC
> -no-feature-CODECS -no-feature-SYSTEMSEMAPHORE, -no-feature-SHAREDMEMORY,
> -no-feature-TRANSLATION -no-feature-HTTP -no-feature-UDPSOCKET
> -no-feature-NETWORKPROXY -no-feature-SOCKS5 -no-feature-NETWORKINTERFACE
> -no-feature-NETWORKDISKCACHE -no-feature-BEARERMANAGEMENT
> -no-feature-LOCALSERVER
> (I still want to switch over to the -qconfig way, but qconfig is not
> automatically built in the Linux desktop build, and has errors for me when
> compiling).
> 
> I realize not all those affect libQt5Core. At that point,
> libQt5Core.so.5.3.0 was about 4.8 MB after stripping (up from 4.3 MB).
> 
> Reduced the size:
> 1. In qtbase/mkspecs/common/gcc-base.conf, I had previously updated
> QMAKE_CFLAGS_OPTIMIZE to use -Os but had left QMAKE_CLAGS_OPTIMIZE_FULL to
> -O3. I then updated QMAKE_CFLAGS_OPTIMIZE_FULL to use -Os. (Save ~0.8 MB)
> 2. Edit corelib.pro to comment out "CONFIG += exceptions" (Save ~380 KB)
> 3. Use the steps that John Layt gave for updating the
> qtbase/util/local_database stuff for locale data, to generate a qlocale.xml,
> remove <locale> items for everything except "C" and US English, then run
> qlocalexml2cpp.py. Noted the effect on
> qtbase/src/corelib/tools/qlocale_data_p.h
> (Save ~0.7 MB)

Nice summary. When I apply these changes until here I'm at 2.3M.
So I think it is even <2.0M possible.

> 4. Have version of
> qtbase/src/corelib/mimetypes/mime/packages/freedesktop.org.xml without
> <comment xml:lang items
> 	 sed '/\<comment xml:lang/d' freedesktop.org.xml >
> no-lang.freedesktop.org.xml
>  Update qtbase/src/corelib/mimetypes/mimetypes.qrc to reference
> no-lang.freedesktop.org.xml
> (Save ~220 KB)
> 
> After these changes, libQt5Core.so.5.3.0 was 3.0 MB stripped!  (3048028
> bytes). If I trimmed the mime types down to a single item and took out the
> DOCTYPE, it went down a little bit more (25KB less).  So, that's "within
> striking distance" now.
> 
> Other things I might still try:
> - Updating the TLD stuff to slim it down.
> - See if I can safely remove some other things from the locale information.
> John? ("likely subtags", language name list, etc.)
> - If there's an update that makes -no-feature-REGULAREXPRESSION work, use
> that.
> 
> 
> A few other comments:
> 
> >Peter Kümmel wrote:
> > Maybe it is worth to think about a Qt library which really only
> > provides essential stuff. What would such a library contain,
> > when all the "but the GUI needs it" was removed?
> 
> QtCore generally has just essential stuff for either UI or non-UI. Of course
> there's other libraries too that have nice things for both UI and non-UI
> like QtNetwork, etc. QtCore does have some things typically used for UI that
> might not be needed for non-UI use, like animations, etc., but there are
> -no-feature items for those (or most those).  We've been using Qt for many
> things for a few years now.  It's a great C++ library in general.  We have
> embedded software without any UI, middleware that runs on desktops or (some)
> mobile without any direct UI, and then UI pieces as well. The middleware
> piece has been used in apps that run .NET on Windows or Objective-C on Mac
> (exposing exported C functions or COM interop/PInvoke, and keeping C++ class
> use internal to the library).
> 
> There's other libraries too that are interesting for non-UI use that Qt
> provides.
> 
> >Thiago Macieira
> > Note that it's configuring something outside of Qt and
> > possibly affecting other applications in your system.
> 
> It seems like the locale reference by qtbase/util/local_database and the
> locale classes are self contained.  It does use data from the outside, but
> I'm not sure how it would affect other applications in the system (unless
> they're using the Qt version we make).
> 
> >Thiago Macieira
> > Why are you even trying to build qttools for your target environment? Just
> > skip the module altogether.
> 
> That's a good idea. I had run it mainly for qtpaths and lrelease.
> 
> >Peter Kümmel
> > So maybe the question should be, what does an essential 1M Qt lib need
> > to be of any use?
> 
> I don't know what a target size would be per-se, but the specific list might
> depend on who you ask.  There are some things that might sound like UI
> related at first, like say QSize QPoint and QRect, but those are actually
> nice to have for non-UI stuff.  I think QtCore largely has essential non-UI
> common things, but a few things that I don't see us using from QtCore for
> non-UI things would be things like the animation related things and the item
> models (though, I could imagine there might be non-UI uses for others to use
> those).
> 
> Thanks,
> -Daniel
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list