Skip to content

Commit

Permalink
Merge pull request #8440 from Connormiha/oprimize-chunk-can-be-integr…
Browse files Browse the repository at this point in the history
…ated

Cache hasRunstime in chunk
  • Loading branch information
sokra committed Nov 30, 2018
2 parents e3e8a68 + 537d3e4 commit 72a8a1f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/Chunk.js
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 72a8a1f

Please sign in to comment.