[Development] QML, v8 and freezing the global object
Thomas McGuire
thomas.mcguire at kdab.com
Thu Oct 11 16:04:04 CEST 2012
Hi,
the QML engine "freezes" the global JS object. This is apparently(?) to
prevent accidental writes to the global object. For those who don't know, the
global object in JS provides objects and properties available in global scope,
such as "console" (for console.log) or "qsTr".
Now, it turned out that freezing the global object takes a lot of time with v8
on BB10 devices. Even in release mode, just the call to freeze the global
object makes the startup time 100ms longer.
v8 seems to have an implmentation of freezing that is suboptimal, see for
example the benchmark at http://jsperf.com/performance-frozen-object. Note
this benchmark is for iterating over properties of frozen objects, not
freezing an object, though likely freezing an object would get similar
benchmark results.
Could we maybe simple get rid of object freezing, and not freeze the global
object?
What would the consequences of that be, anything bad? I am the opinion that if
the user wants to override the "console" object, let him. Maybe there were
other reasons for freezing the global object though?
Regards,
Thomas
--
** Qt Developer Conference: http://qtconference.kdab.com/ **
Thomas McGuire | thomas.mcguire at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3637 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121011/dbc2ffc6/attachment.bin>
More information about the Development
mailing list