Skip to content

Commit

Permalink
Improve performance of incremental bundling (#8583)
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Oct 31, 2022
1 parent 4c273c3 commit c4a898c
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 188 deletions.
16 changes: 4 additions & 12 deletions packages/core/core/src/requests/AssetGraphRequest.js
Expand Up @@ -49,11 +49,7 @@ type AssetGraphRequestInput = {|
requestedAssetIds?: Set<string>,
|};

type AssetGraphRequestResult = AssetGraphBuilderResult & {|
previousAssetGraphHash: ?string,
|};

type AssetGraphBuilderResult = {|
type AssetGraphRequestResult = {|
assetGraph: AssetGraph,
changedAssets: Map<string, Asset>,
assetRequests: Array<AssetGroup>,
Expand All @@ -80,7 +76,6 @@ export default function createAssetGraphRequest(
run: async input => {
let prevResult =
await input.api.getPreviousResult<AssetGraphRequestResult>();
let previousAssetGraphHash = prevResult?.assetGraph.getHash();

let builder = new AssetGraphBuilder(input, prevResult);
let assetGraphRequest = await await builder.build();
Expand All @@ -93,10 +88,7 @@ export default function createAssetGraphRequest(
assetGraphRequest.assetGraph.safeToIncrementallyBundle = false;
}

return {
...assetGraphRequest,
previousAssetGraphHash,
};
return assetGraphRequest;
},
input,
};
Expand Down Expand Up @@ -124,7 +116,7 @@ export class AssetGraphBuilder {

constructor(
{input, api, options}: RunInput,
prevResult: ?AssetGraphBuilderResult,
prevResult: ?AssetGraphRequestResult,
) {
let {
entries,
Expand Down Expand Up @@ -154,7 +146,7 @@ export class AssetGraphBuilder {
this.queue = new PromiseQueue();
}

async build(): Promise<AssetGraphBuilderResult> {
async build(): Promise<AssetGraphRequestResult> {
let errors = [];
let rootNodeId = nullthrows(
this.assetGraph.rootNodeId,
Expand Down

0 comments on commit c4a898c

Please sign in to comment.