Hi, On Friday 12 October 2012 10:17:20 Jedrzej Nowacki wrote: > On Thursday 11. October 2012 16.04.04 Thomas McGuire wrote: > > 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?
> Freezing global object was a language design decision. The problem was > that in QML it would be much easier accidentally add a property to the > global object then in JS. Such mistakes would be quite difficult to debug > in QML. Do you have an example of that? I'd like to see how this can happen, out of interest (and what consequences that would have). > As a side effect there is a few optimizations in declarative > engine that assume frozen global object. As far I remember they speedup > property lookup. Ah, interesting. Does anyone know where in the engine that property lookup optimization takes place? > Algorithm for freezing an object, was never benchmarked. Probably you can > optimize it. You my also try to enable v8 snapshots, if it is not enabled > on your configuration. According to our test it may increase qml boot time > about 5x. I've already enabled snapshots when testing this, and it indeed helps a lot. Pity that v8's simulator doesn't work if the pointer size for host and target is different, therefore I had to manually create a snapshot. > I do not know if it is already done but, maybe you can create a > snapshot with frozen global object, that could solve your problem. I've also been thinking about adding the frozen global object to the snapshot, but I think that will not work. Qt changes the global object, for example by adding the qsTr() function, so freezing would have to happen after Qt is done modifying the object. This is however not possible because the global object then refers to the address of the C++ function for qsTr(). That address can change on each invocation due to address space randomization and other factors, so it is not possible to keep a persistent snapshot. Snapshotting in v8 works because AFAIK the built-in functions there are all pure JS. Startup time of QQmlEngine compared to QDeclarativeEngine is slower, and the biggest contributer there is the object freezing with 100ms. Getting rid of object freezing would be the easiest to fix that. Making object freezing faster in v8 might be possible, but that requires a complete understanding of the v8 engine, which is quite complex. Regards, Thomas -- ** Qt Developer Conference: http://qtconference.kdab.com/ ** Thomas McGuire | [email protected] | 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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
