Skip to content

Commit f82d1d9

Browse files
kuhesmilkuri
authored andcommitted
chore: update bundler benchmark list (#7405)
1 parent f57167d commit f82d1d9

File tree

10 files changed

+40
-8
lines changed

10 files changed

+40
-8
lines changed

scripts/model-analysis/model-analysis.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const root = path.join(__dirname, "..", "..");
99

1010
const models = path.join(root, "codegen", "sdk-codegen", "aws-models");
1111

12+
const protocolCounts = {};
13+
1214
for (const file of fs.readdirSync(models)) {
1315
if (file.endsWith(".json")) {
1416
const model = require(path.join(models, file));
@@ -17,7 +19,12 @@ for (const file of fs.readdirSync(models)) {
1719
const operations = Object.entries(shapes).filter(([id, s]) => {
1820
return s.type === "operation";
1921
});
20-
const protocol = Object.entries(service[1].traits).find(([id, trait]) => id.startsWith("aws.protocol"))[0];
22+
const protocol = Object.entries(service[1].traits).find(
23+
([id, trait]) => id.startsWith("aws.protocol") || id.startsWith("smithy.protocol")
24+
)[0];
25+
26+
protocolCounts[protocol] = protocolCounts[protocol] ?? {};
27+
protocolCounts[protocol][service[0]] = operations.length;
2128

2229
if (protocol.includes("rest")) {
2330
const inputOutputShapes = Object.entries(shapes).filter(([id, s]) => {
@@ -129,3 +136,15 @@ for (const file of fs.readdirSync(models)) {
129136
}
130137
}
131138
}
139+
140+
for (const [protocol, serviceToOperationCounts] of Object.entries(protocolCounts)) {
141+
const entries = Object.entries(serviceToOperationCounts).sort(([s1, c1], [s2, c2]) => {
142+
return c2 - c1;
143+
});
144+
for (const [s, c] of entries) {
145+
delete serviceToOperationCounts[s];
146+
serviceToOperationCounts[s] = c;
147+
}
148+
}
149+
150+
console.log(protocolCounts);

tests/bundlers/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ webpack:
2222

2323
esbuild:
2424
npx esbuild ./source.ts --bundle --outfile=./dist/esbuild-dist.js --format=esm --tree-shaking=true
25-
npx esbuild ./source.ts --bundle --outfile=./dist-min/esbuild-dist.min.js --format=esm --tree-shaking=true --minify
25+
npx esbuild ./source.ts --bundle --outfile=./dist-min/esbuild-dist.min.js --format=esm --tree-shaking=true --minify
26+
27+
clean:
28+
rm -rf dist dist-min dist-vite dist-esbuild dist-webpack
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb";
2+
export { DynamoDBClient } from "@aws-sdk/client-dynamodb";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// group of most used protocols
2+
// excludes CBOR, Query, EC2, and JSON RPC 1.1
3+
4+
export { AwsRestJsonProtocol, AwsRestXmlProtocol, AwsJson1_0Protocol } from "@aws-sdk/core/protocols";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// rest json
2+
export { Connect } from "@aws-sdk/client-connect";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// rest json
2+
export { ConnectClient, ListLambdaFunctionsCommand } from "@aws-sdk/client-connect";

tests/bundlers/runner/BundlerSizeBenchmarker.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class BundlerSizeBenchmarker {
2020
* @returns {Promise<{app:string,size:string,bundler:string}>}
2121
*/
2222
async webpack() {
23-
const outfile = path.resolve(__dirname, "..", "dist", `webpack-dist-${this.application}.js`);
23+
const outfile = path.resolve(__dirname, "..", "dist-webpack", `webpack-dist-${this.application}.js`);
2424

2525
const config = {
2626
mode: "production",
@@ -72,14 +72,14 @@ export class BundlerSizeBenchmarker {
7272
},
7373
minify: true,
7474
emptyOutDir: false,
75+
worker: {
76+
format: "es",
77+
},
7578
rollupOptions: {
76-
input: {
77-
input: inputFile,
78-
},
7979
external: [],
8080
output: {
81+
format: "esm",
8182
dir: path.dirname(outfile),
82-
inlineDynamicImports: true,
8383
},
8484
},
8585
},
@@ -95,7 +95,7 @@ export class BundlerSizeBenchmarker {
9595
*/
9696
async esbuild() {
9797
const entryPoint = path.resolve(__dirname, "..", "applications", this.application);
98-
const outfile = path.resolve(__dirname, "..", "dist", `esbuild-dist-${this.application}.js`);
98+
const outfile = path.resolve(__dirname, "..", "dist-esbuild", `esbuild-dist-${this.application}.js`);
9999

100100
await esbuild.build({
101101
entryPoints: [entryPoint],

0 commit comments

Comments
 (0)