(trunk gtk) companion commit to r11738 to reduce unnecessary re-rendering in the main window
The main window called gtk_tree_model_filter_refilter() once per second to refresh the torrent list's filtering. This is not an efficient approach: gtk_tree_model_filter_refilter() emits a "row changed" event for every row, causing unnecessary re-rendering. I've removed the call to gtk_tree_model_filter_refilter() and expanded the model to includes all the fields necessary for filtering. That way we only fire "row changed" events for rows that actually change. By reducing the number of renders in steady state, this might ameliorate https://bugs.launchpad.net/ubuntu/+source/transmission/+bug/655024 However it will *not* help the related "CPU spikes to 100% on scrolling" ticket at https://trac.transmissionbt.com/ticket/3887 because rendering paused torrents is still exceptionally expensive in the murrine theme.
This commit is contained in:
parent
58c7556534
commit
acd941f17a
|
@ -766,7 +766,9 @@ tr_core_init( GTypeInstance * instance,
|
|||
G_TYPE_INT, /* tr_stat.activity */
|
||||
G_TYPE_UCHAR, /* tr_stat.finished */
|
||||
G_TYPE_CHAR, /* tr_priority_t */
|
||||
G_TYPE_STRING }; /* concatenated trackers string */
|
||||
G_TYPE_STRING, /* concatenated trackers string */
|
||||
G_TYPE_INT, /* MC_ERROR */
|
||||
G_TYPE_INT }; /* MC_ACTIVE_PEER_COUNT */
|
||||
|
||||
p = self->priv = G_TYPE_INSTANCE_GET_PRIVATE( self,
|
||||
TR_CORE_TYPE,
|
||||
|
@ -1280,6 +1282,8 @@ update_foreach( GtkTreeModel * model,
|
|||
gpointer data UNUSED )
|
||||
{
|
||||
int oldActivity, newActivity;
|
||||
int oldActivePeerCount, newActivePeerCount;
|
||||
int oldError, newError;
|
||||
tr_bool oldFinished, newFinished;
|
||||
tr_priority_t oldPriority, newPriority;
|
||||
char * oldCollatedName, * newCollatedName;
|
||||
|
@ -1297,6 +1301,8 @@ update_foreach( GtkTreeModel * model,
|
|||
MC_TORRENT, >or,
|
||||
MC_NAME_COLLATED, &oldCollatedName,
|
||||
MC_ACTIVE, &oldActive,
|
||||
MC_ACTIVE_PEER_COUNT, &oldActivePeerCount,
|
||||
MC_ERROR, &oldError,
|
||||
MC_ACTIVITY, &oldActivity,
|
||||
MC_FINISHED, &oldFinished,
|
||||
MC_PRIORITY, &oldPriority,
|
||||
|
@ -1315,6 +1321,8 @@ update_foreach( GtkTreeModel * model,
|
|||
newTrackers = torrentTrackerString( tor );
|
||||
newUpSpeed = st->pieceUploadSpeed_KBps;
|
||||
newDownSpeed = st->pieceDownloadSpeed_KBps;
|
||||
newActivePeerCount = st->peersSendingToUs + st->peersGettingFromUs + st->webseedsSendingToUs;
|
||||
newError = st->error;
|
||||
inf = tr_torrent_info( gtor );
|
||||
newCollatedName = g_utf8_strdown( inf->name ? inf->name : "", -1 );
|
||||
|
||||
|
@ -1324,6 +1332,8 @@ update_foreach( GtkTreeModel * model,
|
|||
|| ( newActivity != oldActivity )
|
||||
|| ( newFinished != oldFinished )
|
||||
|| ( newPriority != oldPriority )
|
||||
|| ( newError != oldError )
|
||||
|| ( newActivePeerCount != oldActivePeerCount )
|
||||
|| gtr_strcmp0( oldTrackers, newTrackers )
|
||||
|| gtr_strcmp0( oldCollatedName, newCollatedName )
|
||||
|| gtr_compare_double( newUpSpeed, oldUpSpeed, 3 )
|
||||
|
@ -1331,6 +1341,8 @@ update_foreach( GtkTreeModel * model,
|
|||
{
|
||||
gtk_list_store_set( GTK_LIST_STORE( model ), iter,
|
||||
MC_ACTIVE, newActive,
|
||||
MC_ACTIVE_PEER_COUNT, newActivePeerCount,
|
||||
MC_ERROR, newError,
|
||||
MC_ACTIVITY, newActivity,
|
||||
MC_NAME_COLLATED, newCollatedName,
|
||||
MC_FINISHED, newFinished,
|
||||
|
|
|
@ -196,6 +196,16 @@ enum
|
|||
MC_FINISHED,
|
||||
MC_PRIORITY,
|
||||
MC_TRACKERS,
|
||||
|
||||
/* tr_stat.error
|
||||
* Tracked because ACTIVITY_FILTER_ERROR needs the row-changed events */
|
||||
MC_ERROR,
|
||||
|
||||
/* tr_stat.{ peersSendingToUs + peersGettingFromUs + webseedsSendingToUs }
|
||||
* Tracked because ACTIVITY_FILTER_ACTIVE needs the row-changed events */
|
||||
MC_ACTIVE_PEER_COUNT,
|
||||
|
||||
|
||||
MC_ROW_COUNT
|
||||
};
|
||||
|
||||
|
|
|
@ -851,7 +851,6 @@ gtr_window_refresh( TrWindow * self )
|
|||
updateSpeeds( p );
|
||||
updateTorrentCount( p );
|
||||
updateStats( p );
|
||||
gtk_tree_model_filter_refilter( GTK_TREE_MODEL_FILTER( p->filter_model ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue