[Webkit-unassigned] [Bug 147667] Refactor BuildbotQueue.compareIterations and BuildbotQueue.compareIterationsByRevisions to be more generic
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Aug 7 13:40:28 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=147667
--- Comment #3 from Jason Marcell <jmarcell at apple.com> ---
Comment on attachment 258244
--> https://bugs.webkit.org/attachment.cgi?id=258244
Refactor BuildbotQueue.compareIterations and BuildbotQueue.compareIterationsByRevisions to be more generic
View in context: https://bugs.webkit.org/attachment.cgi?id=258244&action=review
>> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:276
>> + }
>
> Notice that the getter Dashboard.sortedRepositories is called twice on each iteration: once in the for-loop condition "i < Dashboard.sortedRepositories.length" (line 271) and once when evaluating "Dashboard.sortedRepositories[i].name" (line 272). We should cache Dashboard.sortedRepositories and Dashboard.sortedRepositories.length in local variables to avoid extraneous calls to Dashboard.sortedRepositories, such that this for-loop reads:
>
> var sortedRepositories = Dashboard.sortedRepositories;
> for (var i = 0, length = sortedRepositories.length; i < sortedRepositories.length; ++i) {
> var repositoryName = sortedRepositories[i].name;
> var result = b.revision[repositoryName] - a.revision[repositoryName];
> if (result)
> return result;
> }
I tried to do the caching in the getter itself. Does this not cache the sortedRepositories using an instance variable?
get sortedRepositories()
{
if (this._sortedRepositories === undefined) {
this._sortedRepositories = this._sortedItems(Dashboard.Repository);
}
return this._sortedRepositories;
},
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150807/54e93085/attachment.html>
More information about the webkit-unassigned
mailing list