Re: [SailfishDevel] Delegate creation on demand

2013-12-16 Thread Hendrik Borghorst
Hi,

thanks for the hint. A workaround like this works. Although I had to
take care of contextMenu height too. 

But at least this is a nicer workaround than taking the model away.

Greetings 

Am Montag, den 16.12.2013, 01:07 + schrieb Chris Adams:
> Hi,
> 
> It seems like the ListItem delegate relies on implicit height for its 
> geometry.  When the empty page is pushed, the delegates get their height set 
> to zero, which causes the listview to create more delegates to fit into the 
> visible area.  Since any finite height divided by zero is infinity, it 
> attempts to create an infinite amount of delegates (or until it runs out of 
> model data).
> 
> The workaround is to do something like this:
> 
> delegate: Component {
> ListItem {
> height: row.height > 5 ? row.height : 5 // don't rely on implicit 
> height for sizing if it goes too small
> Row {
> id: row
> Label {
> text: index
> }
> Label {
> text: value
> }
> }
> Component.onCompleted: {
>console.debug("Created delegate: " + index)
> }
> }
> }
> 
> We should definitely fix this issue in Silica to ensure that the minimal 
> delegate height is clamped to 1 perhaps (well, this is probably not the right 
> solution either, we'll have to think about how to do it properly).
> In the meantime, please try using the workaround.
> 
> Cheers,
> Chris.
> 
> 
> From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
> on behalf of Hendrik Borghorst [hendrikborgho...@gmail.com]
> Sent: Monday, December 16, 2013 6:49 AM
> To: devel@lists.sailfishos.org
> Subject: Re: [SailfishDevel] Delegate creation on demand
> 
> Sure,
> 
> This example I've just created and it does exactly what I want to show.
> 
> greetings and thanks for your support
> 
> There are 2 buttons, one populates the model with 25000 simple items.
> 
> The second one pushes a page above the page with listview. After the
> push you can see the ListView creating lots of delegates in console.log
> 
> PS.: I've not tested it with qmlscene but as an application
> (modeltext.tar.xz) on real device.
> 
> 
> Am Sonntag, den 15.12.2013, 20:25 + schrieb Robin Burchell:
> > Can you please provide a minimal test case (i.e. ideally a single QML file, 
> > usable with qmlscene) demonstrating your problem?
> >
> > Please see http://sscce.org/
> >
> > On 15 Dec 2013, at 21:03, Hendrik Borghorst  
> > wrote:
> >
> > > 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.l...@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" :
> > >>
> > >>> 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)
> > >>>
> > >>
> > >>
> > >>
> > >>
> > >
> > > ___
> > > SailfishOS.org Devel mailing list
> >
> > ___
> > SailfishOS.org Devel mailing list
> 
> ___
> SailfishOS.org Devel mailing list



signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Chris Adams
Hi,

It seems like the ListItem delegate relies on implicit height for its geometry. 
 When the empty page is pushed, the delegates get their height set to zero, 
which causes the listview to create more delegates to fit into the visible 
area.  Since any finite height divided by zero is infinity, it attempts to 
create an infinite amount of delegates (or until it runs out of model data).

The workaround is to do something like this:

delegate: Component {
ListItem {
height: row.height > 5 ? row.height : 5 // don't rely on implicit 
height for sizing if it goes too small
Row {
id: row
Label {
text: index
}
Label {
text: value
}
}
Component.onCompleted: {
   console.debug("Created delegate: " + index)
}
}
}

We should definitely fix this issue in Silica to ensure that the minimal 
delegate height is clamped to 1 perhaps (well, this is probably not the right 
solution either, we'll have to think about how to do it properly).
In the meantime, please try using the workaround.

Cheers,
Chris.


From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of Hendrik Borghorst [hendrikborgho...@gmail.com]
Sent: Monday, December 16, 2013 6:49 AM
To: devel@lists.sailfishos.org
Subject: Re: [SailfishDevel] Delegate creation on demand

Sure,

This example I've just created and it does exactly what I want to show.

greetings and thanks for your support

There are 2 buttons, one populates the model with 25000 simple items.

The second one pushes a page above the page with listview. After the
push you can see the ListView creating lots of delegates in console.log

PS.: I've not tested it with qmlscene but as an application
(modeltext.tar.xz) on real device.


Am Sonntag, den 15.12.2013, 20:25 + schrieb Robin Burchell:
> Can you please provide a minimal test case (i.e. ideally a single QML file, 
> usable with qmlscene) demonstrating your problem?
>
> Please see http://sscce.org/
>
> On 15 Dec 2013, at 21:03, Hendrik Borghorst  
> wrote:
>
> > 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.l...@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" :
> >>
> >>> 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)
> >>>
> >>
> >>
> >>
> >>
> >
> > ___
> > SailfishOS.org Devel mailing list
>
> ___
> SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread christopher . lamb

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" :


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.l...@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" :

> 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)
>











___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Hendrik Borghorst
Sure,

This example I've just created and it does exactly what I want to show.

greetings and thanks for your support

There are 2 buttons, one populates the model with 25000 simple items. 

The second one pushes a page above the page with listview. After the
push you can see the ListView creating lots of delegates in console.log

PS.: I've not tested it with qmlscene but as an application
(modeltext.tar.xz) on real device.


Am Sonntag, den 15.12.2013, 20:25 + schrieb Robin Burchell:
> Can you please provide a minimal test case (i.e. ideally a single QML file, 
> usable with qmlscene) demonstrating your problem?
> 
> Please see http://sscce.org/
> 
> On 15 Dec 2013, at 21:03, Hendrik Borghorst  
> wrote:
> 
> > 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.l...@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" :
> >> 
> >>> 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)
> >>> 
> >> 
> >> 
> >> 
> >> 
> > 
> > ___
> > SailfishOS.org Devel mailing list
> 
> ___
> SailfishOS.org Devel mailing list

import QtQuick 2.0
import Sailfish.Silica 1.0

ApplicationWindow {
Component {
id: mainPage
Page {
SilicaListView {
id: listView
anchors {
top: parent.top
bottom: buttonRow.top
left: parent.left
right: parent.right
}

delegate: Component {
ListItem {
Row {
Label {
text: index
}
Label {
text: value
}
}
Component.onCompleted: {
console.debug("Created delegate: " + index)
}
}
}
}
Row {
id: buttonRow
anchors {
bottom: parent.bottom
right: parent.right
left: parent.left
}

Button {
text: "populate"
onClicked: {

for (var i = 0; i <= 25000; i++) {
// Populate an model with some demo data
console.debug("populating: " + i)
testModel.append({
 index: i,
 value: "Some text"
 })
}
listView.model = testModel
}
}
/** The moment you press on this button
  you can see console.log with delegate creations
  */
Button {
text: "new page"
onClicked: {
pageStack.push(emptyPage)
}
}
}

// Empty model until populated
ListModel {
id: testModel
}
}
}

// Just an empty page for demonstration
Component {
id: emptyPage
Page {
}
}

initialPage: mainPage
}


modeltest.tar.xz
Description: application/xz-compressed-tar


signature.asc
Descripti

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Robin Burchell
Can you please provide a minimal test case (i.e. ideally a single QML file, 
usable with qmlscene) demonstrating your problem?

Please see http://sscce.org/

On 15 Dec 2013, at 21:03, Hendrik Borghorst  wrote:

> 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.l...@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" :
>> 
>>> 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)
>>> 
>> 
>> 
>> 
>> 
> 
> ___
> SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Andrey Kozhevnikov

start with "Dynamic Object Management"

On 16.12.2013 02:21, Hendrik Borghorst wrote:

Than if it is so clear could you be so nice and point me to some
documentation?

Am Montag, den 16.12.2013, 02:19 +0600 schrieb Andrey Kozhevnikov:

you doing it wrong. its all what i see now :)

On 16.12.2013 02:17, Hendrik Borghorst wrote:


It is weird if I have to manually optimize something which worked for 2
years on an old Nokia N8 with 128? MB memory. I don't see any reason for
qt to create those delegate items and as I read the documentation of the
qt-project QAbstractListModel is exactly the way to go.

Also there are cases where manual optimization is far less efficient
than tested optimizations done by compilers or good libraries ;) .

Am Montag, den 16.12.2013, 02:14 +0600 schrieb Andrey Kozhevnikov:

no, i mean manual optimization.

like loading model when it actually requires, or dynamically create
listview with model using component loader or createComponent.

QML is easy and fast when you making small projects. but for complex
you should thinh HOW code actially works after interpretation.

On 16.12.2013 02:08, Hendrik Borghorst wrote:


What do you mean exactly?

Isn't this exactly what ListView should do automatically which can be
influenced with cacheBuffer? Which by the way works correctly as long as
the listview stays visible.

greetings


Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:

load model dynamically?

if you wont preload model before using it can solve many problems.
:)

On 16.12.2013 02:03, Hendrik Borghorst wrote:


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.l...@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" :


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)


___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list



___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Hendrik Borghorst
Than if it is so clear could you be so nice and point me to some
documentation?

Am Montag, den 16.12.2013, 02:19 +0600 schrieb Andrey Kozhevnikov:
> you doing it wrong. its all what i see now :)
> 
> On 16.12.2013 02:17, Hendrik Borghorst wrote:
> 
> > It is weird if I have to manually optimize something which worked for 2
> > years on an old Nokia N8 with 128? MB memory. I don't see any reason for
> > qt to create those delegate items and as I read the documentation of the
> > qt-project QAbstractListModel is exactly the way to go.
> > 
> > Also there are cases where manual optimization is far less efficient
> > than tested optimizations done by compilers or good libraries ;) .
> > 
> > Am Montag, den 16.12.2013, 02:14 +0600 schrieb Andrey Kozhevnikov:
> > > no, i mean manual optimization.
> > > 
> > > like loading model when it actually requires, or dynamically create
> > > listview with model using component loader or createComponent.
> > > 
> > > QML is easy and fast when you making small projects. but for complex
> > > you should thinh HOW code actially works after interpretation.
> > > 
> > > On 16.12.2013 02:08, Hendrik Borghorst wrote:
> > > 
> > > > What do you mean exactly?
> > > > 
> > > > Isn't this exactly what ListView should do automatically which can be
> > > > influenced with cacheBuffer? Which by the way works correctly as long as
> > > > the listview stays visible. 
> > > > 
> > > > greetings
> > > > 
> > > > 
> > > > Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:
> > > > > load model dynamically?
> > > > > 
> > > > > if you wont preload model before using it can solve many problems.
> > > > > :)
> > > > > 
> > > > > On 16.12.2013 02:03, Hendrik Borghorst wrote:
> > > > > 
> > > > > > 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.l...@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" :
> > > > > > > 
> > > > > > > > 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)
> > > > > > > > 
> > > > > > > 
> > > > > > ___
> > > > > > SailfishOS.org Devel mailing list
> > > > > ___
> > > > > SailfishOS.org Devel mailing list
> > > > 
> > > > ___
> > > > SailfishOS.org Devel mailing list
> > > ___
> > > SailfishOS.org Devel mailing list
> > 
> > 
> > ___
> > SailfishOS.org Devel mailing list
> 
> ___
> SailfishOS.org Devel mailing list



signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Andrey Kozhevnikov

you doing it wrong. its all what i see now :)

On 16.12.2013 02:17, Hendrik Borghorst wrote:

It is weird if I have to manually optimize something which worked for 2
years on an old Nokia N8 with 128? MB memory. I don't see any reason for
qt to create those delegate items and as I read the documentation of the
qt-project QAbstractListModel is exactly the way to go.

Also there are cases where manual optimization is far less efficient
than tested optimizations done by compilers or good libraries ;) .

Am Montag, den 16.12.2013, 02:14 +0600 schrieb Andrey Kozhevnikov:

no, i mean manual optimization.

like loading model when it actually requires, or dynamically create
listview with model using component loader or createComponent.

QML is easy and fast when you making small projects. but for complex
you should thinh HOW code actially works after interpretation.

On 16.12.2013 02:08, Hendrik Borghorst wrote:


What do you mean exactly?

Isn't this exactly what ListView should do automatically which can be
influenced with cacheBuffer? Which by the way works correctly as long as
the listview stays visible.

greetings


Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:

load model dynamically?

if you wont preload model before using it can solve many problems.
:)

On 16.12.2013 02:03, Hendrik Borghorst wrote:


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.l...@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" :


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)




___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list



___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Hendrik Borghorst
It is weird if I have to manually optimize something which worked for 2
years on an old Nokia N8 with 128? MB memory. I don't see any reason for
qt to create those delegate items and as I read the documentation of the
qt-project QAbstractListModel is exactly the way to go.

Also there are cases where manual optimization is far less efficient
than tested optimizations done by compilers or good libraries ;) .

Am Montag, den 16.12.2013, 02:14 +0600 schrieb Andrey Kozhevnikov:
> no, i mean manual optimization.
> 
> like loading model when it actually requires, or dynamically create
> listview with model using component loader or createComponent.
> 
> QML is easy and fast when you making small projects. but for complex
> you should thinh HOW code actially works after interpretation.
> 
> On 16.12.2013 02:08, Hendrik Borghorst wrote:
> 
> > What do you mean exactly?
> > 
> > Isn't this exactly what ListView should do automatically which can be
> > influenced with cacheBuffer? Which by the way works correctly as long as
> > the listview stays visible. 
> > 
> > greetings
> > 
> > 
> > Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:
> > > load model dynamically?
> > > 
> > > if you wont preload model before using it can solve many problems.
> > > :)
> > > 
> > > On 16.12.2013 02:03, Hendrik Borghorst wrote:
> > > 
> > > > 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.l...@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" :
> > > > > 
> > > > > > 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)
> > > > > > 
> > > > > 
> > > > > 
> > > > 
> > > > ___
> > > > SailfishOS.org Devel mailing list
> > > ___
> > > SailfishOS.org Devel mailing list
> > 
> > 
> > ___
> > SailfishOS.org Devel mailing list
> 
> ___
> SailfishOS.org Devel mailing list



signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Andrey Kozhevnikov

no, i mean manual optimization.

like loading model when it actually requires, or dynamically create 
listview with model using component loader or createComponent.


QML is easy and fast when you making small projects. but for complex you 
should thinh HOW code actially works after interpretation.


On 16.12.2013 02:08, Hendrik Borghorst wrote:

What do you mean exactly?

Isn't this exactly what ListView should do automatically which can be
influenced with cacheBuffer? Which by the way works correctly as long as
the listview stays visible.

greetings


Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:

load model dynamically?

if you wont preload model before using it can solve many problems.
:)

On 16.12.2013 02:03, Hendrik Borghorst wrote:


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.l...@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" :


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)






___
SailfishOS.org Devel mailing list

___
SailfishOS.org Devel mailing list



___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Hendrik Borghorst
What do you mean exactly?

Isn't this exactly what ListView should do automatically which can be
influenced with cacheBuffer? Which by the way works correctly as long as
the listview stays visible. 

greetings


Am Montag, den 16.12.2013, 02:05 +0600 schrieb Andrey Kozhevnikov:
> load model dynamically?
> 
> if you wont preload model before using it can solve many problems.
> :)
> 
> On 16.12.2013 02:03, Hendrik Borghorst wrote:
> 
> > 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.l...@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" :
> > > 
> > > > 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)
> > > > 
> > > 
> > > 
> > > 
> > 
> > 
> > ___
> > SailfishOS.org Devel mailing list
> 
> ___
> SailfishOS.org Devel mailing list



signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Andrey Kozhevnikov

load model dynamically?

if you wont preload model before using it can solve many problems.
:)

On 16.12.2013 02:03, Hendrik Borghorst wrote:

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.l...@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" :


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)








___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread Hendrik Borghorst
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.l...@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" :
> 
> > 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)
> >
> 
> 
> 
> 



signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Delegate creation on demand

2013-12-15 Thread christopher . lamb

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" :


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)






___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Delegate creation on demand

2013-12-14 Thread Hendrik Borghorst
Hello again,

I think I found the problem. The moment the ListView is not visible anymore
it goes on a killing spree and starts creating delegates for around 50% of
all items in model.

If I put in a workaround like:

model: visible ? modelVar : null

The ListView works.


2013/12/14 Hendrik Borghorst 

> 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)
>
___
SailfishOS.org Devel mailing list

[SailfishDevel] Delegate creation on demand

2013-12-14 Thread Hendrik Borghorst
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)


signature.asc
Description: This is a digitally signed message part
___
SailfishOS.org Devel mailing list