diff --git a/LICENSE b/LICENSE index ded7810b1..9ef90678b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.9.7 - 2014-03-24 +* appchan x - Version 2.9.7 - 2014-03-26 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index b80bc7596..39e895208 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -25,7 +25,7 @@ // ==/UserScript== /* -* appchan x - Version 2.9.7 - 2014-03-24 +* appchan x - Version 2.9.7 - 2014-03-26 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -3809,12 +3809,17 @@ }; DataBoard.prototype.clean = function() { - var boardID, now; + var boardID, keys, now, _i, _len; now = Date.now(); if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) { return; } - for (boardID in this.data.boards) { + keys = Object.keys(this.data.boards); + if (!keys.length) { + return; + } + for (_i = 0, _len = keys.length; _i < _len; _i++) { + boardID = keys[_i]; this.deleteIfEmpty({ boardID: boardID }); diff --git a/builds/crx/script.js b/builds/crx/script.js index 0b527a690..0fbe250be 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.9.7 - 2014-03-24 +* appchan x - Version 2.9.7 - 2014-03-26 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -3096,7 +3096,9 @@ Callbacks.prototype.execute = function(nodes) { var cb, err, errors, i, j, name, node; i = 0; + c.time("Features"); while (name = this.keys[i++]) { + c.time(name); j = 0; cb = this[name]; while (node = nodes[j++]) { @@ -3115,7 +3117,9 @@ }); } } + c.timeEnd(name); } + c.timeEnd("Features"); if (errors) { return Main.handleErrors(errors); } @@ -3865,12 +3869,20 @@ }; DataBoard.prototype.clean = function() { - var boardID, now; + var boardID, keys, now, _i, _len; now = Date.now(); if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) { + c.log('return now'); return; } - for (boardID in this.data.boards) { + keys = Object.keys(this.data.boards); + if (!keys.length) { + c.log('return empty'); + return; + } + c.log('no return'); + for (_i = 0, _len = keys.length; _i < _len; _i++) { + boardID = keys[_i]; this.deleteIfEmpty({ boardID: boardID }); @@ -5448,6 +5460,7 @@ return Index.scrollToIndex(); }, parse: function(pages, pageNum) { + c.time("Generating Index"); Index.parseThreadList(pages); Index.buildThreads(); Index.sort(); @@ -5455,7 +5468,8 @@ Index.pageNav(pageNum); return; } - return Index.buildIndex(); + Index.buildIndex(); + c.timeEnd("Generating Index"); }, parseThreadList: function(pages) { var i, j, live, page, thread, threads; diff --git a/src/General/lib/databoard.class b/src/General/lib/databoard.class index 5af46b36d..a93e90e1a 100755 --- a/src/General/lib/databoard.class +++ b/src/General/lib/databoard.class @@ -64,7 +64,13 @@ class DataBoard now = Date.now() return if (@data.lastChecked or 0) > now - 2 * $.HOUR - for boardID of @data.boards + # Don't even bother writing unless we have data to write + keys = Object.keys @data.boards + return unless keys.length + + # Since we generated the keys anyways, use them to avoid the slow ``Object::hasOwnProperty`` method + # Not that ``Object.keys`` is fast + for boardID in keys @deleteIfEmpty {boardID} @ajaxClean boardID if boardID of @data.boards