Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, September 2007
Re: QTreeWidget performance


Message 1 in thread

On Thursday 26 April 2007 17:53, Paulo Moura Guedes wrote:
> It seems there is margin to improve here has the QTreeWidget is always
> showing the same thing (if the scrolling is not activated), so it doesn't
> need to be updated.

I tested with setUpdatesEnabled set to false and I still noticed a major 
slowdown when the number of items increased. 
With ~10000 items it's very slow. 

I attached gdb to the process and I could cpu cycles are being spent in 
QTreeView::doItemsLayout.
Is this normal, i.e., is this function necessary with setUpdatesEnabled set to 
false?

Bellow I paste some of the traces I got (which invariably included the 
doItemsLayout call):

#0  QList<QTreeWidgetItem*>::lastIndexOf (this=0x84c5a78, t=@0xbf90e8a8, 
from=604) at qlist.h:630
#1  0xb6e20390 in QTreeModel::index (this=0x82fdf60, item=0x8c873a0, column=0) 
at itemviews/qtreewidget.cpp:229
#2  0xb6e207a6 in QTreeModel::parent (this=0x82fdf60, child=@0xbf90e910) at 
itemviews/qtreewidget.cpp:274
#3  0xb6df26ed in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90e968) at itemviews/qtreeview.cpp:3025
#4  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=17, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#5  0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90ea08) at itemviews/qtreeview.cpp:3039
#6  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=0, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#7  0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90eacc) at itemviews/qtreeview.cpp:3039
#8  0xb6df4166 in QTreeView::doItemsLayout (this=0x82f8000) at 
itemviews/qtreeview.cpp:1760
#9  0xb6daf934 in QAbstractItemView::timerEvent (this=0x82f8000, 
event=0xbf90f404) at itemviews/qabstractitemview.cpp:2093
#10 0xb6df4bc4 in QTreeView::timerEvent (this=0x82f8000, event=0xbf90f404) at 
itemviews/qtreeview.cpp:1151
#11 0xb7e86c43 in QObject::event (this=0x82f8000, e=0xbf90f404) at 
kernel/qobject.cpp:1097
#12 0xb6948694 in QWidget::event (this=0x82f8000, event=0xbf90f404) at 
kernel/qwidget.cpp:6449
#13 0xb6c9455e in QFrame::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qframe.cpp:657
#14 0xb6d297e1 in QAbstractScrollArea::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qabstractscrollarea.cpp:876
#15 0xb6db3e9d in QAbstractItemView::event (this=0x82f8000, event=0xbf90f404) 
at itemviews/qabstractitemview.cpp:1308
#16 0xb6e1fc44 in QTreeWidget::event (this=0x82f8000, e=0xbf90f404) at 
itemviews/qtreewidget.cpp:3283
#17 0xb68f44af in QApplicationPrivate::notify_helper (this=0x8072e78, 
receiver=0x82f8000, e=0xbf90f404) at kernel/qapplication.cpp:3558
#18 0xb68f6248 in QApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
e=0xbf90f404) at kernel/qapplication.cpp:3499
#19 0xb79b96dc in KApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
event=0xbf90f404)
    at /home/kde/trunk/KDE/kdelibs/kdeui/kernel/kapplication.cpp:300
#20 0xb7e70d96 in QCoreApplication::notifyInternal (this=0xbf90f698, 
receiver=0x82f8000, event=0xbf90f404) at kernel/qcoreapplication.cpp:532
#21 0xb7e74ce1 in QCoreApplication::sendEvent (receiver=0x82f8000, 
event=0xbf90f404) at qcoreapplication.h:202
#22 0xb7e9f332 in QTimerInfoList::activateTimers (this=0x807a17c) at 
kernel/qeventdispatcher_unix.cpp:556

_________________________________________________________________________________________

#0  QPersistentModelIndex::operator= (this=0x2d814d2c, other=@0x2d814d30) at 
kernel/qabstractitemmodel.cpp:231
#1  0xb6df7be8 in qCopy<QPersistentModelIndex*, QPersistentModelIndex*> 
(begin=0x2d814d34, end=0x2d817244, dest=0x2d814d30) at qalgorithms.h:77
#2  0xb6df7c9c in QVector<QPersistentModelIndex>::erase (this=0x82f82bc, 
abegin=0x2d810998, aend=0x2d81099c) at qvector.h:566
#3  0xb6df7d52 in QVector<QPersistentModelIndex>::erase (this=0x82f82bc, 
pos=0x2d810998) at qvector.h:228
#4  0xb6df275b in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90e968) at itemviews/qtreeview.cpp:3029
#5  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=9, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#6  0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90ea08) at itemviews/qtreeview.cpp:3039
#7  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=0, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#8  0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90eacc) at itemviews/qtreeview.cpp:3039
#9  0xb6df4166 in QTreeView::doItemsLayout (this=0x82f8000) at 
itemviews/qtreeview.cpp:1760
#10 0xb6daf934 in QAbstractItemView::timerEvent (this=0x82f8000, 
event=0xbf90f404) at itemviews/qabstractitemview.cpp:2093
#11 0xb6df4bc4 in QTreeView::timerEvent (this=0x82f8000, event=0xbf90f404) at 
itemviews/qtreeview.cpp:1151
#12 0xb7e86c43 in QObject::event (this=0x82f8000, e=0xbf90f404) at 
kernel/qobject.cpp:1097
#13 0xb6948694 in QWidget::event (this=0x82f8000, event=0xbf90f404) at 
kernel/qwidget.cpp:6449
#14 0xb6c9455e in QFrame::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qframe.cpp:657
#15 0xb6d297e1 in QAbstractScrollArea::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qabstractscrollarea.cpp:876
#16 0xb6db3e9d in QAbstractItemView::event (this=0x82f8000, event=0xbf90f404) 
at itemviews/qabstractitemview.cpp:1308
#17 0xb6e1fc44 in QTreeWidget::event (this=0x82f8000, e=0xbf90f404) at 
itemviews/qtreewidget.cpp:3283
#18 0xb68f44af in QApplicationPrivate::notify_helper (this=0x8072e78, 
receiver=0x82f8000, e=0xbf90f404) at kernel/qapplication.cpp:3558
#19 0xb68f6248 in QApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
e=0xbf90f404) at kernel/qapplication.cpp:3499
#20 0xb79b96dc in KApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
event=0xbf90f404)
    at /home/kde/trunk/KDE/kdelibs/kdeui/kernel/kapplication.cpp:300
#21 0xb7e70d96 in QCoreApplication::notifyInternal (this=0xbf90f698, 
receiver=0x82f8000, event=0xbf90f404) at kernel/qcoreapplication.cpp:532
#22 0xb7e74ce1 in QCoreApplication::sendEvent (receiver=0x82f8000, 
event=0xbf90f404) at qcoreapplication.h:202
#23 0xb7e9f332 in QTimerInfoList::activateTimers (this=0x807a17c) at 
kernel/qeventdispatcher_unix.cpp:556

_________________________________________________________________________________________

#0  0xb7db45b5 in q_atomic_decrement (ptr=0x2bb98a68) at qatomic_i386.h:97
#1  0xb7db462b in QBasicAtomic::deref (this=0x2bb98a68) at qatomic.h:93
#2  0xb7e6963f in QPersistentModelIndex::operator= (this=0x2d8193b4, 
other=@0x2d8193b8) at kernel/qabstractitemmodel.cpp:226
#3  0xb6df7be8 in qCopy<QPersistentModelIndex*, QPersistentModelIndex*> 
(begin=0x2d8193bc, end=0x2d81ba38, dest=0x2d8193b8) at qalgorithms.h:77
#4  0xb6df7c9c in QVector<QPersistentModelIndex>::erase (this=0x82f82bc, 
abegin=0x2d810998, aend=0x2d81099c) at qvector.h:566
#5  0xb6df7d52 in QVector<QPersistentModelIndex>::erase (this=0x82f82bc, 
pos=0x2d810998) at qvector.h:228
#6  0xb6df275b in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90e968) at itemviews/qtreeview.cpp:3029
#7  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=59, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#8  0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90ea08) at itemviews/qtreeview.cpp:3039
#9  0xb6df299c in QTreeViewPrivate::expand (this=0x82f8058, item=0, 
emitSignal=false) at itemviews/qtreeview.cpp:2527
#10 0xb6df27f7 in QTreeViewPrivate::reexpandChildren (this=0x82f8058, 
parent=@0xbf90eacc) at itemviews/qtreeview.cpp:3039
#11 0xb6df4166 in QTreeView::doItemsLayout (this=0x82f8000) at 
itemviews/qtreeview.cpp:1760
#12 0xb6daf934 in QAbstractItemView::timerEvent (this=0x82f8000, 
event=0xbf90f404) at itemviews/qabstractitemview.cpp:2093
#13 0xb6df4bc4 in QTreeView::timerEvent (this=0x82f8000, event=0xbf90f404) at 
itemviews/qtreeview.cpp:1151
#14 0xb7e86c43 in QObject::event (this=0x82f8000, e=0xbf90f404) at 
kernel/qobject.cpp:1097
#15 0xb6948694 in QWidget::event (this=0x82f8000, event=0xbf90f404) at 
kernel/qwidget.cpp:6449
#16 0xb6c9455e in QFrame::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qframe.cpp:657
#17 0xb6d297e1 in QAbstractScrollArea::event (this=0x82f8000, e=0xbf90f404) at 
widgets/qabstractscrollarea.cpp:876
#18 0xb6db3e9d in QAbstractItemView::event (this=0x82f8000, event=0xbf90f404) 
at itemviews/qabstractitemview.cpp:1308
#19 0xb6e1fc44 in QTreeWidget::event (this=0x82f8000, e=0xbf90f404) at 
itemviews/qtreewidget.cpp:3283
#20 0xb68f44af in QApplicationPrivate::notify_helper (this=0x8072e78, 
receiver=0x82f8000, e=0xbf90f404) at kernel/qapplication.cpp:3558
#21 0xb68f6248 in QApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
e=0xbf90f404) at kernel/qapplication.cpp:3499
#22 0xb79b96dc in KApplication::notify (this=0xbf90f698, receiver=0x82f8000, 
event=0xbf90f404)
    at /home/kde/trunk/KDE/kdelibs/kdeui/kernel/kapplication.cpp:300
#23 0xb7e70d96 in QCoreApplication::notifyInternal (this=0xbf90f698, 
receiver=0x82f8000, event=0xbf90f404) at kernel/qcoreapplication.cpp:532
#24 0xb7e74ce1 in QCoreApplication::sendEvent (receiver=0x82f8000, 
event=0xbf90f404) at qcoreapplication.h:202
#25 0xb7e9f332 in QTimerInfoList::activateTimers (this=0x807a17c) at 
kernel/qeventdispatcher_unix.cpp:556

Paulo

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx