From 537d3e482fdeb698494e0606c258ca2c3da9ffbc Mon Sep 17 00:00:00 2001 From: Mihail Bodrov Date: Fri, 30 Nov 2018 02:59:26 +0300 Subject: [PATCH] Cache hasRunstime in chunk --- lib/Chunk.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/Chunk.js b/lib/Chunk.js index a0a3397d6d2..b7811c5b516 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -454,6 +454,10 @@ class Chunk { } canBeIntegrated(otherChunk) { + if (this.preventIntegration || otherChunk.preventIntegration) { + return false; + } + const isAvailable = (a, b) => { const queue = new Set(b.groupsIterable); for (const chunkGroup of queue) { @@ -466,14 +470,13 @@ class Chunk { return true; }; - if (this.preventIntegration || otherChunk.preventIntegration) { - return false; - } + const selfHasRuntime = this.hasRuntime(); + const otherChunkHasRuntime = otherChunk.hasRuntime(); - if (this.hasRuntime() !== otherChunk.hasRuntime()) { - if (this.hasRuntime()) { + if (selfHasRuntime !== otherChunkHasRuntime) { + if (selfHasRuntime) { return isAvailable(this, otherChunk); - } else if (otherChunk.hasRuntime()) { + } else if (otherChunkHasRuntime) { return isAvailable(otherChunk, this); } else { return false;