[Qt-interest] Model/View speed of Models with many many items and item changes

Arnold Krille arnold at arnoldarts.de
Fri Jun 12 19:48:19 CEST 2009


Hi,

On Friday 12 June 2009 16:26:05 Heiko Steindl wrote:
> I have a question about the speed of Qt's models and what kind of model
> is the best for many items.
> The problem is, that the model should have approx. 100.000 rows and
> about 30 columns with one QTableView connected.

I don't know if the standard-model is actually fast enough for this. It is 
generalized to be used by many people, but for these amounts of data and the 
specialized structure some more optimized model could be good.
I know I am using optimized models and even then I am fighting for 
optimization. Changing 5.000 - 10.000 items per second requires some 
strategies.

> Inserting the data is fast (I currently use QStandardItemModel), but
> than, the data of about 20.000 items (x 3 columns) should be
> changed.
> This is taking a long time and uses about ~ 80 - 100% of one cpu core.

The problem is probably that the standard models send a dataChanged() for each 
changed index. In my models I add the changed models into a cache-list and 
check that list for top-right and bottom-left only once or twice per second. 
The gui then becomes slightly delayed but overall the app is then much more 
responsive (and faster).

> What could I do, to speed this up or is there another model better for
> this case?

As I said, your own specialized model is probably more suitable.

> I thought about a in memory sqlite database with a QSqlTableModel, but I
> don't know, if this makes sense and would be faster.

I once tried to use an sqlite-db for my data-storage but even when "storing" 
it in a tmpfs dir, it was _really_ slow. Haven't yet done any more tests with 
a dedicated mysqld...
Network-transparency over dbus is currently more important.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090612/c1e66679/attachment.bin 


More information about the Qt-interest-old mailing list