Performace Problem with Text
-
Hello there,
at the moment i struggle with some Performance Problems of my App I Develop in QML.
I generated a new example Qt Quick-UI so demonstrate my problem
@import QtQuick 2.2
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}@The Problem is, that the generating of the Text takes 1.808s
Heres a Screenshot of the QML-Profiler:
!http://ngleichauf.de/download/screen.png(Screenshot)!How can i fix this issue?
Thanks
-
You are asking about initialisation performance: I doubt you can do anything there.
Please try with changing "renderType":http://qt-project.org/doc/qt-5/qml-qtquick-text.html#renderType-prop property. It can have big impact on runtime performance, although I doubt it will change much in the initialisation time.
-
Oh i forgot to mention that I already tried to set the renderType.
This Code changes nothing. The Time is 1.811s.@import QtQuick 2.2
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
renderType: Text.NativeRendering
antialiasing: false
smooth: false
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}@My sytem is Mac OS X 10.9.2 on on MacBook Pro Retina 2012
-
Hi, I tried your example on windows and it takes like 20 ms to create the Text element. Still by far the slowest item but nothing compared to your time!?
!http://i60.tinypic.com/r2kfa8.jpg(qml profiler)!
-
I think there has been reported performance issues in particular when loading the QFontDatabase data at startup, which would have no relation to rendering time. That said I have never heard about performance as bad as this so it might be worth reporting.
A few points though:- make sure you don't compare performance using a debug build
- if its the font database this should be a one time cost. Consecutive instances for Text would be much faster.
- the amount of fonts installed might affect the performance. Do you have a lot of fonts installed on the mac?
-
Thanks for your answer and your hints.
I think you are right. Further texts do not impact the Time in the way the first does.
!http://www.ngleichauf.de/download/screen2.png(screenshot)!I now don't have any additional fonts installed on my Mac, i ensured it and deleted all the additional fonts i installed.
The problem is also there if I build the release of the program.
Also if it is a one time cost to load the font database it takes much to long in my opinion, in which the problem is not there when using windows.
I use a splash screen at the moment to load the main content in background, but this is only necessary because the first text loads this long.
Thanks!
Greets Nico