#2184: Speed optimizations to the torrentview in GTKUI
-------------------+--------------------------------------------------------
 Reporter:  bro    |       Owner:                
     Type:  patch  |      Status:  new           
 Priority:  minor  |   Milestone:  1.3.x         
Component:  gtkui  |     Version:  git 1.3-stable
 Keywords:         |  
-------------------+--------------------------------------------------------
 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.

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/2184>
Deluge <http://deluge-torrent.org/>
Deluge project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-dev?hl=en.

Reply via email to