[Qt-qml] QDeclarativeItem subclasses and mouse events
michael.brasser at nokia.com
michael.brasser at nokia.com
Thu Aug 5 08:03:36 CEST 2010
On 04/08/2010, at 8:17 PM, ext Jan Ekholm wrote:
> On Wednesday 04 August 2010 05:53:13 michael.brasser at nokia.com wrote:
>> Hi,
>>
>> On 03/08/2010, at 4:55 AM, ext Jan Ekholm wrote:
>>> I was recommended to make a C++ QDeclarativeItem subclass for my game map
>>> tiles to get better performance. This worked well
>>
>> Given the simplicity of the QML tile (from http://gitorious.org/tactics),
>> I'm a bit surprised that using a C++ item made a difference in
>> performance. What sort of performance issues were you seeing, and on what
>> platform(s)?
>
> The most noticeable difference is when creating the scene, i.e. when the QML
> file is loaded. A base based on the old Image item that I used instead of a
> C++ Hex took a lot longer to set up. I tried to get rid of the slow sounding
> Repeater too, but that can not be done with QML just yet. But that simple
> change made scenes much faster to load and the panning is a bit smoother too.
>
> I never really had any panning issues, not even on an N900, but setup time was
> not exactly fast. As there is a fair deal of QML used the time just seemed to
> get longer and longer. On a fast desktop PC it took 3-10 to load the initial
> game QML file that also sets up the map. Now it's much faster.
In tests/benchmarks/declarative there is a tool called qmltime that can be used to profile component creation costs. Running my N900:
* the original QML tile took 2.13ms to create
* the same tile with the 5 bindings removed (just assigning the values directly) took .35ms
For this component, *none* of the bindings hit the binding optimizer, which is why removing them had such a large impact. We'll continue to expand the scope of the optimizer (so it hits more cases), as well as further optimize those that don't hit the optimizer in future releases, so hopefully these cases become fewer and fewer.
The above wouldn't account for the 3-10s load time you are seeing on the PC though, so maybe there are some additional factors in play for this particular case (but nothing jumped out at me).
For X11, also remember to use the raster or GL graphics systems for optimal QML performance.
Regards,
Michael
More information about the Qt-qml
mailing list