PDA

View Full Version : Deploy the huge QtWebKit4.dll



ahmdsd_ostora
22nd July 2010, 09:39
I use in my application these classes (and their dependencies of course)

QWebView , QWebPage , QWebFrame

and this forces me to deploy the hude QtWebKit4.dll (15 Mega Bytes)

is there any way to just include only the classes that I need, not all the kit dll ?

wysota
22nd July 2010, 10:17
Yes, you can strip down what you don't use. I'm not sure how much you can strip from WebKit though. Use the qconfig utility to disable some defines and then recompile Qt.

ahmdsd_ostora
22nd July 2010, 11:18
where is the qconfig utility ?
i found a Qt project at (\qt\tools) with this name, is this what u mean?

wysota
22nd July 2010, 12:23
i found a Qt project at (\qt\tools) with this name, is this what u mean?
Yes. Build and run it.

ahmdsd_ostora
22nd July 2010, 12:43
hey, I found the project and built it myself, ran the qconfig.exe , chose the qfeatues.txt, searched among the features, but I didn't find any webkit related features.
I found networking, phonon, images, kernel, etc.

any help?

ahmdsd_ostora
24th July 2010, 09:19
so, I will build Qt statically.

But, can I use plugins while statically linking? (phonon or imageformats)

SixDegrees
24th July 2010, 16:37
Why would you build statically? You'll still have the dependency on Webkit, which will now be statically linked and no smaller than its dynamic version; the only difference will be that every applicaiton you build it with will include its own copy of Webkit attached, and will load these copies into memory when run. Static builds won't reduce the final size, and will wind up duplicating code if multiple applications are involved.

Webkit, unfortunately, is vast and monolithic; it builds as a single library, and that's pretty much the end of the story. There's nothing you can do about it, short of possibly stripping the resulting dll and making sure you're not building in debug mode, which includes many additional symbols.

Note, too, that 15 MB of memory is rarely a concern with today's multi-gigabyte memory footprints. While examining resource usage with an eye toward reducing it is admirable, it may not be worthwhile in this case.

wysota
24th July 2010, 19:06
As far as I remember WebKit simply can't be built in static mode. I might be wrong though, I never tried it myself or at least I don't remember doing so.

ahmdsd_ostora
25th July 2010, 09:18
Will static build add all the dll binary to my exe (if static build is avialable for WebKit) ?
shouldn't it add only the used portions?

really adding 15 mega to a 4 mega exe just for displating a web view is unacceptable

wysota
25th July 2010, 09:33
Will static build add all the dll binary to my exe (if static build is avialable for WebKit) ?
shouldn't it add only the used portions?
The thing is it is not the actually used code that counts but rather code used by classes used in the code. So if QWebPage has a QWebPage::setContentEditable() method and you are not using it, as far as I understand the code will still be included in your exe because you are using QWebPage (and WebKit is probably calling this method somewhere by itself).


really adding 15 mega to a 4 mega exe just for displating a web view is unacceptable
So don't use a QWebView, use QTextBrowser instead :)

ahmdsd_ostora
25th July 2010, 09:54
1- I understand that static build only adds any implementations that used by my used classes, not all classes in the WebKit !!, may be I am wrong.
2- I cannot use TextViewer because I am showing Google Maps :(

Thank you :)

wysota
25th July 2010, 10:16
1- I understand that static build only adds any implementations that used by my used classes, not all classes in the WebKit !!, may be I am wrong.
But if you are using QWebView which is using QWebPage which is using QWebHistory then despite the fact that you are not referencing QWebHistory in your own code, it will still be embedded into your app.


2- I cannot use TextViewer because I am showing Google Maps :(
Functionality comes at a cost. See how large Firefox is.

ahmdsd_ostora
25th July 2010, 10:21
But if you are using QWebView which is using QWebPage which is using QWebHistory then despite the fact that you are not referencing QWebHistory in your own code, it will still be embedded into your app.

I agree, but QWebView doesn't reference all the WebKit classess, so the argument is why all the classess are included ? I doubt

wysota
25th July 2010, 10:29
Could you give examples of such classes which are unreferenced by QWebView or its dependencies?

ahmdsd_ostora
25th July 2010, 11:00
mmmm, I am surprised, the WebKit only has 15 classes. May be the QtWebKit module need some design enhancement to manage the deployed size.

SixDegrees
25th July 2010, 11:31
really adding 15 mega to a 4 mega exe just for displating a web view is unacceptable

Why? What systems will this application be deployed on that will suffer from such resource usage?

wysota
25th July 2010, 11:40
May be the QtWebKit module need some design enhancement to manage the deployed size.
You can always strip out some functionality but let's face it -- there is not much to be stripped if you want full HTML5, CSS and JavaScript support. The only benefit I see from having an application built statically is to use i.e. upx to compress the executable but then it will still be decompressed in memory when ran so it's just a matter of how large the deployment archive is.

ahmdsd_ostora
25th July 2010, 12:28
Why? What systems will this application be deployed on that will suffer from such resource usage?

Competition between vendors involves some memory usage, package size, and more considerations.

SixDegrees
25th July 2010, 12:40
Competition between vendors involves some memory usage, package size, and more considerations.

I find it hard to believe that a 15-20 MB application will make any difference on current hardware; it represents only a few percent, at most, of available memory even on tiny devices.

At the end of the day, there's nothing you can do. Webkit is not modular, so you're stuck with the whole bundle. I'm just having a hard time believing that a few megabytes is either significant or important.

ahmdsd_ostora
25th July 2010, 12:41
You can always strip out some functionality but let's face it -- there is not much to be stripped if you want full HTML5, CSS and JavaScript support. The only benefit I see from having an application built statically is to use i.e. upx to compress the executable but then it will still be decompressed in memory when ran so it's just a matter of how large the deployment archive is.

I couldn't strip out anything from WebKit, qconfig doesn't mention it in its list.

ahmdsd_ostora
25th July 2010, 12:44
I find it hard to believe that a 15-20 MB application will make any difference on current hardware; it represents only a few percent, at most, of available memory even on tiny devices.

At the end of the day, there's nothing you can do. Webkit is not modular, so you're stuck with the whole bundle. I'm just having a hard time believing that a few megabytes is either significant or important.

maybe I think strangely due to my mobile development experience :)

SixDegrees
25th July 2010, 12:45
BTW - have you tried stripping your dynamic libraries and executables? This is commonly done for distributions in order to eliminate unneeded symbols. On Linux, you just say 'strip <object file>'; no idea how to accomplish this on other systems, but there's probably a utility available.I vaguely recall that qmake provides stripping capabilities, but we always did it manually.

Note that this is not the functional stripping mentioned earlier; it simply removes unused symbols from the object's symbol table that aren't required at runtime.

wysota
25th July 2010, 12:46
"Vendors" tend to use WebKit more and more so compiling it statically into your application only makes your application larger without any benefits as WebKit may already be present on the target device.

SixDegrees
25th July 2010, 12:46
Today's phones and other mobile devices have enormous amounts of memory available for applications - several hundred megabytes at a minimum.

Before you spend a lot of time solving a problem, it's worthwhile determining whether the problem actually exists.

ahmdsd_ostora
25th July 2010, 12:48
BTW - have you tried stripping your dynamic libraries and executables? This is commonly done for distributions in order to eliminate unneeded symbols. On Linux, you just say 'strip <object file>'; no idea how to accomplish this on other systems, but there's probably a utility available.I vaguely recall that qmake provides stripping capabilities, but we always did it manually.

Note that this is not the functional stripping mentioned earlier; it simply removes unused symbols from the object's symbol table that aren't required at runtime.

is there any place to search in about this stripping on Windows?

ahmdsd_ostora
25th July 2010, 12:51
Today's phones and other mobile devices have enormous amounts of memory available for applications - several hundred megabytes at a minimum.

Before you spend a lot of time solving a problem, it's worthwhile determining whether the problem actually exists.

If you will guarantee that all the users who will use your application have the last models of your concerned platform, you won't think in resources then.

It's some sort of "performance portability", or "portability of performance"

ahmdsd_ostora
25th July 2010, 12:54
"Vendors" tend to use WebKit more and more so compiling it statically into your application only makes your application larger without any benefits as WebKit may already be present on the target device.

But I cannot rely on this anyway, I should include it, so we reached the same point.

wysota
25th July 2010, 12:56
I don't think Windows provides any means of stripping (I'd say DLLs are always "stripped" as only some symbols are exported). It's just removing visible symbol names and labels so don't expect any magic. My stripped version of WebKit is still 17MB in size (Linux/i686).

SixDegrees
25th July 2010, 16:58
You're not convincing me that 15-20 MB is a problem.

My first personal computer had 64k of memory, only half of which was available to applications. There are still a few of these around and working, but I don't bother constraining my applications to run on them.

Once again, the answer at the end of the day is simple - you're out of luck. Webkit isn't modular, and doesn't allow you to make use of subsets of its library. If Webkit's size is a problem, you'll have to find some other way to do whatever it is you're working on.

hobbyist
25th July 2010, 17:30
If you want to optimize your binaries for size on Win32, you might want to consider using the MS compiler. The size of the release version QtWebKit4.dll (Qt 4.6.3) is less than 10 MB when built with VS 2008.

ChrisW67
25th July 2010, 23:25
A few megabytes in a download that is fetched by thousands of times adds up very quickly and can make a dent in limited hosting budgets. That said, the Qt release libraries do compact well in the average Windows deployment system (Linux etc. compression is similar/better). If you use UPX on the libraries first then the distribution archive will not compress them further but they will retain a reduced installed size (at the slight expense of performance).

You also need to be aware that WebKit is licensed under the LGPL only. This has effects for static linkage in commercial projects (regardless of whether you have a commercial Qt licence).