Opened 12 years ago

Closed 12 years ago

Last modified 6 years ago

#2184 closed patch (Fixed)

Speed optimizations to the torrentview in GTKUI

Reported by: Bro Owned by:
Priority: minor Milestone: 2.0.0
Component: GTK UI Version: master
Keywords: Cc:

Description

With many torrents (hundreds), the GTKUI torrent view gets noticeably slower and slower. With around 1800 torrents, each call to update_view takes around 400-600ms on my machine, when showing all the torrents. This causes the entire thing to freeze until it's finished updating.

I've optimized the update_view method so that now, each update takes around 15-20ms when showing all torrents with sorting on the Name column, and a little less with no sorting. CPU usage when showing the All list is down from 90-100% to 4-10%

It's still quite slow to change list, e.g. from a small list (say "Downloading" with a couple of torrents), to "All" with 1800 torrents. This takes about 350-400ms on my machine.

Thats because it has to do this for most of the torrents:

row[filter_column] = True

Also loading the list when first connecting was crazy slow because of a very inefficient way of adding the rows to the liststore. Adding the rows is now down from about 3 seconds to 20-30ms.

The two most important changes for the speed increase is:

  • Test for the value row[filter_column] before setting a new value.
 if row[filter_column] is True:
   row[filter_column] = False
 if row[filter_column] is False:
   row[filter_column] = True

  • The first try/catch in the for-loop (for row in self.liststore)

Since most updates are of the same list, we now expect the torrent_id to be in the status dictionary, instead of first checking if it is.

Optimized update_view and add_rows on 1-3-stable: https://github.com/bendikro/deluge/commit/762ad783e2b4d22c74955ddd0bbe86fc13d8550f

If anyones interested, a version with time tests and prints is in the branch 1.3-dev-torrentview_time_test.

Change History (8)

comment:1 by Bro, 12 years ago

After profiling some more I found that cell_data_trackericon was using quite a lot of time as well. After running Deluge for 38 seconds (changing lists all the time), cell_data_trackericon was using 5.2 seconds.

Reading the tracker icon from disk every time it's called is kind of slow ;-)

After adding caching of the pixbuf it's down to 1.8 seconds, running Deluge for 45 seconds. https://github.com/bendikro/deluge/commit/bb3422698670015dcc41030658a3e2e9e55b6a2f

comment:2 by Calum, 12 years ago

Milestone: 1.3.x1.3.6

comment:3 by Calum, 12 years ago

Milestone: 1.3.61.4.0

comment:4 by Bro, 12 years ago

Version: git 1.3-stablegit master

Speedups for master branch: https://github.com/bendikro/deluge/commits/master-torrentview-speedups Will make a master branch for the tracker icons as well.

comment:5 by Bro, 12 years ago

Tracker icon patch for master is here: http://dev.deluge-torrent.org/ticket/2248

comment:6 by Chase, 12 years ago

Resolution: fixed
Status: newclosed

Merged in b4f5e78a7

comment:7 by Calum, 9 years ago

Milestone: 2.0.x2.0

comment:8 by Calum, 6 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.