We've done some preliminary experimentation with this, but it did not generally 
lead to an improvement because the case of item creation is optimized by 
delaying evaluation of bindings until component completion. Changing a number 
of bindings (i.e. roles) on existing items can result in bindings being 
evaluated multiple times which can be costly, especially for text layout.  
There are probably delegates which would see improvement from this and it is 
something we will revisit in the future.

Reuse would also not work if the delegates store any state - there is no way to 
restore a delegate to its initial state.

Br,
Martin.


> -----Original Message-----
> From: [email protected] [mailto:qt-qml-
> [email protected]] On Behalf Of ext Adriano
> Rezende
> Sent: Saturday, 5 February 2011 1:04 AM
> To: [email protected]
> Subject: [Qt-qml] ListView (optimization flags)
> 
> Hi,
> 
> While comparing the QML ListView performance with an old ListView of
> mine (http://qt.gitorious.org/~arezende/qt-labs/arezende-
> clone/blobs/master/shared/listview.cpp),
> it's clear that in 'low end' devices (X6/N97/5800) the QML ListView is
> not smooth as it could be.
> 
> I didn't take any benchmark, but looking at the code I've saw a
> possible culprit; In the current implementation the delegate items are
> constantly being destroyed and recreated while scrolling the list, and
> the cacheBuffer property just postpone the problem and is not scalable
> for huge lists.
> 
> In my implementation I just reuse the items, switching them like a
> carousel. The items are being kept alive and erased before reuse (when
> needed).
> 
> Probably the QML ListView is implemented that way to ease the
> developer work. But in most of the use cases the delegates does not
> create items dynamically inside them, so they could be reused even
> without any clean process. For the rare cases where a clean is needed,
> an "indexAboutToChange" signal could be provided.
> 
> It would be nice if an optimization flag were provided like the following:
> 
> ListView {
>     recycle: true
>     delegate: listDelegate
> }
> 
> Component {
>     id: listDelegate
> 
>     Item {
>         onIndexAboutToChange: {
>             // clean dynamically created items if needed
>         }
>     }
> }
> 
> This recycle property would be more powerful than cacheBuffer property
> and would also be scalable.
> 
> I didn't look deeply at the QML ListView, so my assumptions could be
> wrong. Someone with a deeper knowledge of the ListView source code
> would like to discuss this?
> 
> Br,
> Adriano
> _______________________________________________
> Qt-qml mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to