]> granicus.if.org Git - transmission/commitdiff
speedups found by chrome's profiler
authorJordan Lee <jordan@transmissionbt.com>
Wed, 24 Aug 2011 03:40:23 +0000 (03:40 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Wed, 24 Aug 2011 03:40:23 +0000 (03:40 +0000)
web/javascript/torrent-row.js
web/javascript/transmission.js

index 330b7ac997635d39b7872640ac69b62a2c446361..4fca6cef7c6e76e754181703f8ce27f2055020e9 100644 (file)
@@ -63,10 +63,12 @@ TorrentRendererHelper.renderProgressbar = function(controller, t, progressbar)
        var e;
        e = progressbar.complete;
        e.style.width = '' + info.percent + "%";
-       e.className = info.complete;
+       if (e.className !== info.complete)
+               e.className = info.complete;
        e.style.display = info.percent<=0 ? 'none' : 'block';
        e = progressbar.incomplete;
-       e.className = info.incomplete;
+       if (e.className !== info.incomplete)
+               e.className = info.incomplete;
        e.style.display = info.percent>=100 ? 'none' : 'block';
 };
 
index edf2df9cebfb034be0fcf2cae95eb3d829d84aff..2370fb9583b6b0f19de4d0d022598d6c14e0169d 100644 (file)
@@ -1502,7 +1502,6 @@ Transmission.prototype =
 
                this.setPref(Prefs._ShowInspector, true);
                this.updateInspector();
-               this.refreshDisplay();
        },
 
        /*
@@ -1523,7 +1522,6 @@ Transmission.prototype =
                }
 
                this.setPref(Prefs._ShowInspector, false);
-               this.refreshDisplay();
        },
 
        refreshMetaData: function(ids) {
@@ -1672,12 +1670,6 @@ Transmission.prototype =
                }
        },
 
-       refreshDisplay: function()
-       {
-               for (var i=0, row; row=this._rows[i]; ++i)
-                       row.render(this);
-       },
-
        /*
         * Set the alternating background colors for torrents
         */
@@ -2013,7 +2005,7 @@ Transmission.prototype =
                if (!this.refilterTimer)
                {
                        var tr = this;
-                       this.refilterTimer = setTimeout(function() {tr.refilter();}, 200);
+                       this.refilterTimer = setTimeout(function() {tr.refilter();}, 500);
                }
        },
 
@@ -2057,7 +2049,7 @@ Transmission.prototype =
                        fragment.appendChild(row.getElement());
                        rows.push(row);
                }
-               $('ul.torrent_list li').remove();
+               $('ul.torrent_list').empty();
                delete this._rows;
                this._rows = rows;
                this._torrent_list.appendChild(fragment);
@@ -2067,7 +2059,6 @@ Transmission.prototype =
                this.updateStatusbar();
                if (sel.length !== new_sel_count)
                        this.selectionChanged();
-               this.refreshDisplay();
                this.refreshFilterButton();
        },