From: Martin Jones Date: Tue, 4 Oct 2011 23:05:40 +0000 (+1000) Subject: Couple more performance tips. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=8846c36bcad1d05879e6765953c5267ae782a905;p=konrad%2Fqtdeclarative.git Couple more performance tips. Change-Id: Id0f5db95addd6ecc6c2816ba8dbfae58fa8e231f Reviewed-on: http://codereview.qt-project.org/6001 Reviewed-by: Martin Jones --- diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 6f79cff..d79f474 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -50,7 +50,7 @@ Qt applications. \o \l{QML for Qt Programmers}{QML Programming for Qt Programmers} \o \l{Getting Started Programming with QML} -\o \l{What's New in QtQuick 2}{What's New in the Qt Quick Release} +\o \l{What's New in Qt Quick 2}{What's New in the Qt Quick Release} \o \l{QML Examples and Demos} \endlist diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc index adbd9db..737f19f 100644 --- a/doc/src/declarative/qdeclarativeperformance.qdoc +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\page qdeclarativeperformance.html +\page qtquick2-performance.html \title QML Performance \section1 Opaque Items @@ -115,36 +115,30 @@ provide an image that includes the frame and the shadow. Avoid running JavaScript during animation. For example, running a complex JavaScript expression for each frame of an x property animation. -\section1 Rendering +\section1 Loading later -Often using a different graphics system will give superior performance to the native -graphics system (this is especially the case on X11). This can be configured using -QApplication::setGraphicsSystem() or via the command line using the \c -graphicssystem -switch. +Startup time is influenced by the amount of QML that must be loaded. Breaking your +application into components which can be loaded when needed will allow faster startup time. +This allows better runtime memory management by unloading the components when no +longer needed. -You can enable OpenGL acceleration using the \c opengl graphics system, or by setting a -QGLWidget as the viewport of your QDeclarativeView. +This may be achieved by using either \l Loader or creating components +\l {Dynamic Object Management in QML}{dynamically}. -You may need to try various options to find what works the best for your application. -For embedded X11-based devices one recommended combination is to use the raster graphics -system with a QGLWidget for the viewport. While this doesn't guarantee the \bold fastest -performance for all use-cases, it typically has \bold{consistently good} performance for -all use-cases. In contrast, only using the raster paint engine may result in very good -performance for parts of your application and very poor performance elsewhere. +\section1 Property Types -The QML Viewer uses the raster graphics system by default for X11 and OS X. It also -includes a \c -opengl command line option which sets a QGLWidget as the viewport of the -view. On OS X, a QGLWidget is always used. - -You can also prevent QDeclarativeView from painting its window background if -you will provide the background of your application using QML, e.g. +When possible use a specific type, rather than variant, when declaring properties. \code -QDeclarativeView window; -window.setAttribute(Qt::WA_OpaquePaintEvent); -window.setAttribute(Qt::WA_NoSystemBackground); -window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); -window.viewport()->setAttribute(Qt::WA_NoSystemBackground); +Item { + property variant foo: 10 + property real bar: 10 + + x: foo * 2 + y: bar *3 +} \endcode +bar is faster than foo. + */ diff --git a/doc/src/qtquick1/declarativeui.qdoc b/doc/src/qtquick1/declarativeui.qdoc index 568eaf9..6769fb0 100644 --- a/doc/src/qtquick1/declarativeui.qdoc +++ b/doc/src/qtquick1/declarativeui.qdoc @@ -140,7 +140,7 @@ examples for porting} \list \o \l{QML Best Practices: Coding Conventions}{Coding Tips} -\o \l{QML Performance}{Performance Tips} +\o \l{QML Performance - Qt Quick 1}{Performance Tips} \endlist \section1 License Information diff --git a/doc/src/qtquick1/qdeclarativeperformance.qdoc b/doc/src/qtquick1/qdeclarativeperformance.qdoc index 03643e7..ba2402c 100644 --- a/doc/src/qtquick1/qdeclarativeperformance.qdoc +++ b/doc/src/qtquick1/qdeclarativeperformance.qdoc @@ -27,7 +27,7 @@ /*! \page qdeclarativeperformance.html -\title QML Performance +\title QML Performance - Qt Quick 1 \section1 Opaque Items