[Qt-qml] QML file size and performance
erik.verbruggen at nokia.com
erik.verbruggen at nokia.com
Tue Nov 16 09:28:48 CET 2010
On Nov 16, 2010, at 8:48 , ext Alan Alpert wrote:
> On Tue, 16 Nov 2010 17:28:19 ext kalyan reddy wrote:
>> I am guessing Yes. There should be reduction in amount of data to be read
>> and evaluated(Which needs to be done at somepoint). This is worth
>> checking, unless it's being handled already.
>>
>> br,
>> kalyan
>>
>> On Tue, Nov 16, 2010 at 2:22 AM,
>> <jerome.pasion at nokia.com<mailto:jerome.pasion at nokia.com>> wrote: Hello,
>>
>> A question I received was about QML file sizes and performance on mobile
>> devices. Would there be huge performance benefits by stripping the
>> comments or white space from QML files? (Other than the obvious file size
>> reduction.)
>>
>> Cheers,
>> Jerome P.
>>
>
> I'm guessing no to huge benefits though. You may save on startup time but I
> doubt that reading the files in is a large cost. The files are reprocessed into
> a binary in-memory representation at startup, so by runtime there should be no
> performance difference (i.e. we've effectively already discarded comments and
> whitespace). This may not be true for the javascript files though, since I
> javascriptcore may like large JS files to be shrunk and we'd just be passing
> those in to JSC.
We did some measurements on desktop machines of the QML parser/engine, and tried whitespace removal and inserting all semicolons. We found out that yes, it is faster, although it's very hard to measure reliably (timer granularity and etc.). We also found that if you do more than *only* parse the file, you might be lucky and get 0.5% improvement, and then only on start-up, nowhere else.
Meaning: it is not worth it at all.
Because to measure it, you need big files, and there the time to instantiate objects, connect signals & slots, etc. takes *significantly* more time. Another conclusion was that it's more expensive to load a shared library than to parse a bunch of big QML files.
Regards,
Erik.
--
Erik Verbruggen
Software Engineer
Nokia, Qt Development Frameworks
Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
More information about the Qt-qml
mailing list