[Qt-interest] Fwd: Why QListView is so slow and QTableView is fast?
Jeffrey Brendecke
jwbrendecke at icanetix.com
Wed Aug 26 14:55:45 CEST 2009
On Wednesday 26 August 2009 14:36:07 Sylvain Pointeau wrote:
> ---------- Forwarded message ----------
> From: Kenneth Beck <nekkceb at comcast.net>
> Date: Wed, Aug 26, 2009 at 2:26 PM
> Subject: Re: [Qt-interest] Why QListView is so slow and QTableView is fast?
> To: Sylvain Pointeau <sylvain.pointeau at gmail.com>
>
> Sylvain Pointeau wrote:
> > Hi,
> >
> > I am testing QListView for a large number of items (36'000)...
> > it is so sloooow (I stopped the application, it never shows up) .
> > (yes I set UniformItemSizes to true)
> >
> > I tried QTableView and it is immediate.
> > However the scrolling become slow if we are viewing the last elements.
> >
> > Please can someone give me some insights?
> >
> > Cheers,
> > Sylvain
> >
> > I am having a very similar problem with a QTableView. Once the model is
>
> filled and the user is just moving around the table, just moving from one
> cell to the other, or moving the scroll bar, takes a lot of time. Each call
> to the data() method requires a search into the model to find the data, but
> the model only contains a few 10's of items, it is not large. Does anyone
> know where to look for ways to speed this up? Are there some optimization
> tricks?
----------------
You may want to consider reviewing how your data is being searched in the
model. Calls to data() may be occurring very frequently. With such a small
dataset, it seems even a linear search through the data may perform OK.
* Are calls being made over a network each time?
* Is data being read and re-read off the disk each time?
* Is your model going through a layer of abstraction that may be hiding the
bad performance?
One simple check is to compile your app as a console app and put some qDebug()
statements along with some contextual information in data() to run a simple
check of how often data() is being called. That might make it easier to trace
from there as to where the performance bottleneck may be.
I have used QTableView and QAbstractTableModel on large datasets (100,000's of
items) with excellent performance, even with sorting through a proxy model.
More information about the Qt-interest-old
mailing list