From 9b58b7caec9cf4259370ca080c8c45c98d808868 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 7 Jun 2024 14:54:22 -0400 Subject: [PATCH 1/2] add jsii slowdown metric Signed-off-by: Sumu --- .github/workflows/build.yml | 5 +++++ projenrc/benchmark-test.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26a4c7af..920dcb62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -405,8 +405,12 @@ jobs: summary.push([compiler, pre(ms.format(min)), pre(ms.format(avg)), pre(ms.format(max)), pre(dec.format(stddev)), pre(`${dec.format(avg / fastest)}x`)].join(" | ")); const key = 'duration-' + compiler; const value = avg; + const slowdownKey = compiler + '-slowdown'; + const slowdownValue = dec.format(avg / fastest); fs.appendFileSync(outputFilePath, `${key}=${value} + `) + fs.appendFileSync(outputFilePath, `${slowdownKey}=${slowdownValue} `) } summary.push(""); @@ -425,3 +429,4 @@ jobs: run: |- aws cloudwatch put-metric-data --metric-name TSC-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-tsc }} aws cloudwatch put-metric-data --metric-name JSII-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-jsii }} + aws cloudwatch put-metric-data --metric-name JSII-slowdown --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.jsii-slowdown }} diff --git a/projenrc/benchmark-test.ts b/projenrc/benchmark-test.ts index c1e08c40..3d7bd25e 100644 --- a/projenrc/benchmark-test.ts +++ b/projenrc/benchmark-test.ts @@ -118,8 +118,11 @@ export class BenchmarkTest { ' summary.push([compiler, pre(ms.format(min)), pre(ms.format(avg)), pre(ms.format(max)), pre(dec.format(stddev)), pre(`${dec.format(avg / fastest)}x`)].join(" | "));', ` const key = 'duration-' + compiler;`, ` const value = avg;`, + ` const slowdownKey = compiler + '-slowdown';`, + ` const slowdownValue = dec.format(avg / fastest);`, '', ' fs.appendFileSync(outputFilePath, `${key}=${value}\n`)', + ' fs.appendFileSync(outputFilePath, `${slowdownKey}=${slowdownValue}\n`)', '}', 'summary.push("");', '', @@ -143,6 +146,7 @@ export class BenchmarkTest { run: [ 'aws cloudwatch put-metric-data --metric-name TSC-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-tsc }}', 'aws cloudwatch put-metric-data --metric-name JSII-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-jsii }}', + 'aws cloudwatch put-metric-data --metric-name JSII-slowdown --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.jsii-slowdown }}', ].join('\n'), }, ], From 1ce54ab1a31f0eb18a0c11ab2d37562a7f7a1f47 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 7 Jun 2024 14:59:31 -0400 Subject: [PATCH 2/2] add condition for main branch Signed-off-by: Sumu --- .github/workflows/build.yml | 2 ++ projenrc/benchmark-test.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 920dcb62..2041cb55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -418,6 +418,7 @@ jobs: fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, summary.join("\n"), "utf-8"); EOF - name: Authenticate Via OIDC Role + if: github.ref == 'refs/heads/main' uses: aws-actions/configure-aws-credentials@v4 with: aws-region: us-east-1 @@ -426,6 +427,7 @@ jobs: role-session-name: github-diff-action@cdk-ops output-credentials: true - name: Publish Metrics + if: github.ref == 'refs/heads/main' run: |- aws cloudwatch put-metric-data --metric-name TSC-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-tsc }} aws cloudwatch put-metric-data --metric-name JSII-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-jsii }} diff --git a/projenrc/benchmark-test.ts b/projenrc/benchmark-test.ts index 3d7bd25e..4cf0260e 100644 --- a/projenrc/benchmark-test.ts +++ b/projenrc/benchmark-test.ts @@ -132,6 +132,7 @@ export class BenchmarkTest { }, { name: 'Authenticate Via OIDC Role', + if: `github.ref == 'refs/heads/main'`, uses: 'aws-actions/configure-aws-credentials@v4', with: { 'aws-region': 'us-east-1', @@ -143,6 +144,7 @@ export class BenchmarkTest { }, { name: 'Publish Metrics', + if: `github.ref == 'refs/heads/main'`, run: [ 'aws cloudwatch put-metric-data --metric-name TSC-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-tsc }}', 'aws cloudwatch put-metric-data --metric-name JSII-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-jsii }}',