[SailfishDevel] Delegate creation on demand

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sun Dec 15 21:46:46 UTC 2013


Hi Hendrik

My feeling is also that you have stumbled upon a bug.

Your update with the visible = false crossed mine.

My understanding was that all delegates are created when the ListView  
is created / Loaded. I see no reason at all why the ListView should go  
on a creation spree when it becomes INVISIBLE. That seems counter  
intuitive to me.

It has been suggested that you use dynamic loading, but I don't think  
that helps your problem. Just to be clear, I have used that technique  
successfully in two ways.

1) in my app Landed overall startup time was poor. One of the reasons  
was that all pages were being created on startup, and one was loading  
the phone's ContactModel. Given that the user may never actually get  
as far as the Page containing the ContactModel, I decided it would be  
better to dynamically load the ContactModel if and when that page  
becomes visible. So the app now starts fast, with the slight downside  
that if a user choses to access the phone's contacts, he needs to wait  
at at that point for the ContactModel to load.

2) Once the ContactModel was loaded (with several hundred contacts),  
scrolling in the ListView was terrible. The solution here was to make  
the delegate as lightweight as possible, and to dynamically load all  
the bits required when the delegate is clicked.

However from the behaviour you describe, none of that will help you. I  
need to do some thinking ...

bis bald

Chris

Zitat von "Hendrik Borghorst" <hendrikborghorst at gmail.com>:

> Hello,
>
> the problem isn't my delegate. It is quite minimal.
>
> The problem is I think a bug in QML Listview. It goes absolutly crazy if
> it is invisible and starts making delegate for around 50% of all items.
> This causes the memory to run full.
>
> A workaround I added is
>
> model: visible ? modelVar : null
>
> which works quite nicely. I think this bug could be an upstream qt bug?
>
> greetings
>
> Am Sonntag, den 15.12.2013, 10:01 +0100 schrieb
> christopher.lamb at thurweb.ch:
>> Hi Hendrik
>>
>> Have you seen this? http://qt-project.org/wiki/Performance_tip_Lists
>>
>> The general advice is to keep the delegates is lightweight as
>> possible, and to use Loaders for anything needed later (e.g. onClick)
>>
>> Chris
>>
>> Zitat von "Hendrik Borghorst" <hendrikborghorst at gmail.com>:
>>
>> > Hello folks,
>> >
>> > I've got a problem with long lists (~25000 elements). All delegates are
>> > created at once which causes the memory usage to explode beyond the
>> > devices capability.
>> >
>> > I already tried setting "cacheBuffer: 0" in SiliciaListView but  it
>> > doesn't change it.
>> >
>> > Is the something I'm doing wrong.
>> >
>> > You can see the actual page code here:
>> >
>> >  
>> https://github.com/djselbeck/smpc/blob/master/pages/CurrentPlaylistPage.qml
>> >
>> > Shouldn't the delegates be constructed on demand? It is weird because my
>> > old n8 wasn't struggling with qml lists with this size.
>> >
>> > greetings and congrats on getting the devices to your customers (I'm
>> > very pleased)
>> >
>>
>>
>>
>>
>
>





More information about the Devel mailing list