QML pages compilation issue
-
Is there a way to compile the QML pages on demand (before I run them) ?
-
QML is an interpreted language; it's not compiled.
Why do you ask?
-
I disagree.
Please take a look at the QML profiler (Qt Creator -> Analyze) -
Hi,
JKSH is right, it's not compiled see for example "here":http://qt-project.org/doc/qt-4.8/qdeclarativeintroduction.html
QML is JavaScript based
-
So can you please explain me what does the compilation segment on the QML profiler mean ?
-
[quote author="aabc" date="1395039338"]So can you please explain me what does the compilation segment on the QML profiler mean ?[/quote]That's a JavaScript JIT compiler, which is different from a static compiler: http://stackoverflow.com/questions/95635/what-does-a-just-in-time-jit-compiler-do
Lots of people are asking for a static compiler for QML, but that feature looks like it won't be ready for a long time yet (assuming that it will arrive): http://stackoverflow.com/questions/17070135/qml-pre-compilation-to-bytecode-is-it-possible
AFAIK, there is no way to manually invoke the JIT compiler. In any case, I'm not sure if there there are any benefits to letting developers control the JIT compiler.
What are your plans?
-
I want to reduce the QML pages loading time.
I have some QML pages who takes 200ms to compile . -
[quote author="aabc" date="1395067289"]I want to reduce the QML pages loading time.
I have some QML pages who takes 200ms to compile .[/quote]This documentation might help you: "Performance Considerations And Suggestions":http://qt-project.org/doc/qt-5.0/qtquick/qtquick-performance.html
-
[quote author="JKSH" date="1395066257"][quote author="aabc" date="1395039338"]So can you please explain me what does the compilation segment on the QML profiler mean ?[/quote]That's a JavaScript JIT compiler[/quote]Sorry, I wasn't quite correct. This post explains QML "compilation": https://www.kdab.com/qml-engine-internals-part-1-qml-file-loading/ Basically, it parses a QML file and stores optimized data in RAM, to make it faster to generate C++ objects.
[quote author="aabc" date="1395067289"]I want to reduce the QML pages loading time.
I have some QML pages who takes 200ms to compile .[/quote]You can defer loading by using a "Loader":http://qt-project.org/doc/qt-5/qml-qtquick-loader.html, or load a component asynchronously by using "Component.incubateObject()":http://qt-project.org/doc/qt-5/qml-qtqml-component.html#incubateObject-method