Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(core): Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. #12957

Closed
idm-ryou opened this issue Feb 10, 2021 · 2 comments
Closed
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@idm-ryou
Copy link

idm-ryou commented Feb 10, 2021

This is the second time opening issue that I report SynthUtil.toCloudFormation is slow. The first issue was #10213, and the fixes made execution a bit faster, but it is still much slower (about x10) compared to the implementation of @aws-cdk/assert v1.56.

  • v1.56: $ jest took 12 secs
  • v1.89: $ cdk synth took 12 secs
  • v1.89: $ jest took 130 secs

Reproduction Steps

import * as cdk from "@aws-cdk/core";
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert"; // 1.89
// Codes of @aws-cdk/assert v1.56 are copied to local files to switch implementations
// import { SynthUtils } from "./cdk-copy/assert/lib" // 1.56
import { app } from "./app";

describe("app", () => {
  const stacks = app.node.children
    .filter(cdk.Stack.isStack);

  test("stack templates match snapshots", () => {
    stacks.forEach((stack) => {
      expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(
        stack.stackName
      );
    });
  });
});

What did you expect to happen?

Execution time is about same as v1.56 and pretty much equivalent to cdk synth

What actually happened?

Execution time is about x10 slower compared to v1.56 and simple cdk synth

Environment

  • CDK CLI Version : 1.89.0
  • Framework Version: 1.89.0
  • Node.js Version: v15.8.0, v12.20.1
  • OS : macOS, Linux
  • Language (Version): TypeScript 4.1.3

Other

Here are Node.js profiling results.


This is 🐛 Bug Report

@idm-ryou idm-ryou added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 10, 2021
@idm-ryou idm-ryou changed the title [core] Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. 8core) Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. Feb 10, 2021
@idm-ryou idm-ryou changed the title 8core) Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. (core) Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. Feb 10, 2021
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Feb 10, 2021
@idm-ryou idm-ryou changed the title (core) Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. (core): Slow execution at SynthUtils.toCloudFormation on v1.57.0 cont. Feb 10, 2021
@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p1 labels Feb 15, 2021
@NGL321 NGL321 removed the needs-triage This issue or PR still needs to be triaged. label Jul 23, 2021
@idm-ryou
Copy link
Author

Using assertions.Template.toJSON addressed this issue now.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

No branches or pull requests

3 participants