From 2e55c1f3077920ae6258de9c034073d984ef6462 Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Tue, 4 Nov 2014 12:24:37 +0300 Subject: [PATCH] Optimize torrentRow a bit The problem is that torrentRow() does linear search over the list of all available torrents. So it doesn't scale well for large number of torrents. Removing the copying of QString from linear search inner loop, speed up it considerably. The proper solution should be using hash table instead of linear search. This require more radical changes in TorrentModel and may be done in a separate commit. --- src/qtlibtorrent/torrentmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qtlibtorrent/torrentmodel.h b/src/qtlibtorrent/torrentmodel.h index e62fce743..a39de99e5 100644 --- a/src/qtlibtorrent/torrentmodel.h +++ b/src/qtlibtorrent/torrentmodel.h @@ -57,7 +57,7 @@ public: inline int columnCount() const { return NB_COLUMNS; } QVariant data(int column, int role = Qt::DisplayRole) const; bool setData(int column, const QVariant &value, int role = Qt::DisplayRole); - inline QString hash() const { return m_hash; } + inline QString const& hash() const { return m_hash; } State state() const; signals: