Changeset 11740


Ignore:
Timestamp:
Jan 21, 2011, 5:07:23 PM (11 years ago)
Author:
jordan
Message:

(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.

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-core.c

    r11739 r11740  
    767767                      G_TYPE_UCHAR,     /* tr_stat.finished */
    768768                      G_TYPE_CHAR,      /* tr_priority_t */
    769                       G_TYPE_STRING };  /* concatenated trackers string */
     769                      G_TYPE_STRING,    /* concatenated trackers string */
     770                      G_TYPE_INT,       /* MC_ERROR */
     771                      G_TYPE_INT };     /* MC_ACTIVE_PEER_COUNT */
    770772
    771773    p = self->priv = G_TYPE_INSTANCE_GET_PRIVATE( self,
     
    12811283{
    12821284    int oldActivity, newActivity;
     1285    int oldActivePeerCount, newActivePeerCount;
     1286    int oldError, newError;
    12831287    tr_bool oldFinished, newFinished;
    12841288    tr_priority_t oldPriority, newPriority;
     
    12981302                        MC_NAME_COLLATED, &oldCollatedName,
    12991303                        MC_ACTIVE, &oldActive,
     1304                        MC_ACTIVE_PEER_COUNT, &oldActivePeerCount,
     1305                        MC_ERROR, &oldError,
    13001306                        MC_ACTIVITY, &oldActivity,
    13011307                        MC_FINISHED, &oldFinished,
     
    13161322    newUpSpeed = st->pieceUploadSpeed_KBps;
    13171323    newDownSpeed = st->pieceDownloadSpeed_KBps;
     1324    newActivePeerCount = st->peersSendingToUs + st->peersGettingFromUs + st->webseedsSendingToUs;
     1325    newError = st->error;
    13181326    inf = tr_torrent_info( gtor );
    13191327    newCollatedName = g_utf8_strdown( inf->name ? inf->name : "", -1 );
     
    13251333        || ( newFinished != oldFinished )
    13261334        || ( newPriority != oldPriority )
     1335        || ( newError != oldError )
     1336        || ( newActivePeerCount != oldActivePeerCount )
    13271337        || gtr_strcmp0( oldTrackers, newTrackers )
    13281338        || gtr_strcmp0( oldCollatedName, newCollatedName )
     
    13321342        gtk_list_store_set( GTK_LIST_STORE( model ), iter,
    13331343                            MC_ACTIVE, newActive,
     1344                            MC_ACTIVE_PEER_COUNT, newActivePeerCount,
     1345                            MC_ERROR, newError,
    13341346                            MC_ACTIVITY, newActivity,
    13351347                            MC_NAME_COLLATED, newCollatedName,
  • trunk/gtk/tr-core.h

    r11709 r11740  
    197197    MC_PRIORITY,
    198198    MC_TRACKERS,
     199
     200    /* tr_stat.error
     201     * Tracked because ACTIVITY_FILTER_ERROR needs the row-changed events */
     202    MC_ERROR,
     203
     204    /* tr_stat.{ peersSendingToUs + peersGettingFromUs + webseedsSendingToUs }
     205     * Tracked because ACTIVITY_FILTER_ACTIVE needs the row-changed events */
     206    MC_ACTIVE_PEER_COUNT,
     207
     208
    199209    MC_ROW_COUNT
    200210};
  • trunk/gtk/tr-window.c

    r11738 r11740  
    852852        updateTorrentCount( p );
    853853        updateStats( p );
    854         gtk_tree_model_filter_refilter( GTK_TREE_MODEL_FILTER( p->filter_model ) );
    855854    }
    856855}
Note: See TracChangeset for help on using the changeset viewer.