Sometimes we hit a slow path in kmail threading, where it kmail can max out a cpu for serval minutes to thread just a couple of thousand mails.
All time, according to sysprof, is spent in this codepath:
QAbstractItemModelPrivate::rowsAboutToBeRemoved(QModelIndex const&, int, int) 7.31% 73.98%
MessageList::Core::Model::parent(QModelIndex const&) const 5.81% 64.26%
MessageList::Core::Model::index(MessageList::Core::Item*, int) const 6.15% 52.34%
MessageList::Core::Item::indexOfChildItem(MessageList::Core::Item*) const 17.49% 37.77%
QList<MessageList::Core::Item*>::count() const 1.61% 14.72%
QList<MessageList::Core::Item*>::at(int) const 1.47% 3.70%
This is likely an explosion of signals in the model stack, and not the threading code itself