From 247cf770d031546139ab35af66e048b20fc88cbd Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Mon, 5 Mar 2018 21:35:56 -0800 Subject: [PATCH] Avoid O(N^2) loop when loading channel emotes on channel load --- package.json | 2 +- src/channel/emotes.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4cfd165e..1a995a99 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.55.0", + "version": "3.55.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel/emotes.js b/src/channel/emotes.js index 5384c857..88641ca2 100644 --- a/src/channel/emotes.js +++ b/src/channel/emotes.js @@ -126,9 +126,7 @@ EmoteModule.prototype = Object.create(ChannelModule.prototype); EmoteModule.prototype.load = function (data) { if ("emotes" in data) { - for (var i = 0; i < data.emotes.length; i++) { - this.emotes.updateEmote(data.emotes[i]); - } + this.emotes = new EmoteList(data.emotes); } this.dirty = false;