From 4b16ef8896de89b632f97efb012834fe6074edd7 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Wed, 24 Aug 2011 03:40:23 +0000 Subject: [PATCH] speedups found by chrome's profiler --- web/javascript/torrent-row.js | 6 ++++-- web/javascript/transmission.js | 13 ++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/web/javascript/torrent-row.js b/web/javascript/torrent-row.js index 330b7ac99..4fca6cef7 100644 --- a/web/javascript/torrent-row.js +++ b/web/javascript/torrent-row.js @@ -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'; }; diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js index edf2df9ce..2370fb958 100644 --- a/web/javascript/transmission.js +++ b/web/javascript/transmission.js @@ -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(); }, -- 2.40.0