mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Emit TorrentModel::dataChanged() signal only for specific rows, not for the entire table
In commit b50d733
TorrentModel moved from a periodic refresh, to using
postStatusUpdate(). In this transition I forgot to remove emition of
dataChanged() signal for the entire table.
According to my measurements this commit reduce CPU usage of qbittorrent
by a factor of 3:
Before:
Total wall clock: 97.07s
CPU time: 21.77s
- Time spent in TransferListDelegate::paint(): 14.60s
- Time spent in TorrentModel::forceModelRefresh(): 1.44s
- Time spent in TorrentModel::stateUpdated(): 0.02s
After:
Total wall clock: 96.13s
CPU time: 6.68s
- Time spent in TransferListDelegate::paint(): 2.63s
- Time spent in TorrentModel::forceModelRefresh(): <0.01s
- Time spent in TorrentModel::stateUpdated(): 1.73s
As it is seen the time spent in painting is reduced by a factor of 6 (14.60->2.63) at
the cost of slightly increased time of notifications that model is
changed (1.44->1.73). The next commits attempt to address this issue.
This commit is contained in:
parent
2e55c1f307
commit
e5c024967d
@ -508,7 +508,6 @@ void TorrentModel::setRefreshInterval(int refreshInterval)
|
||||
|
||||
void TorrentModel::forceModelRefresh()
|
||||
{
|
||||
emit dataChanged(index(0, 0), index(rowCount()-1, columnCount()-1));
|
||||
QBtSession::instance()->postTorrentUpdate();
|
||||
}
|
||||
|
||||
@ -591,8 +590,10 @@ void TorrentModel::stateUpdated(const std::vector<libtorrent::torrent_status> &s
|
||||
libtorrent::torrent_status const& status = *i;
|
||||
|
||||
const int row = torrentRow(misc::toQString(status.info_hash));
|
||||
if (row >= 0)
|
||||
if (row >= 0) {
|
||||
m_torrents[row]->refreshStatus(status);
|
||||
notifyTorrentChanged(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user