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 #10213

Closed
idm-ryou opened this issue Sep 7, 2020 · 2 comments
Closed

[core] Slow execution at SynthUtils.toCloudFormation on v1.57.0 #10213

idm-ryou opened this issue Sep 7, 2020 · 2 comments
Assignees
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue.

Comments

@idm-ryou
Copy link

idm-ryou commented Sep 7, 2020

Our unit test execution takes considerably long time, when we upgrade CDK from v1.56.0 to v1.57.0.

  • v1.56.0: $ jest took 59 seconds
  • v1.57.0: $ jest took 673 seconds

I suspect that changes from #9342 affected our codes.
Is there any workaround to make it faster like previous version?

Reproduction Steps

Our test code something looks like followings:

import * as cdk from "@aws-cdk/core";
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert";
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
      );
    });
  });
});

The app is pretty large and it has 55 stacks and the snapshot file has about 23,000 lines.

Environment

  • CLI Version :1.57.0
  • Framework Version:1.57.0
  • Node.js Version:v12.18.3
  • OS :Linux(Docker)
  • Language (Version):TypeScript (3.8.3)

Other


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 Sep 7, 2020
@github-actions github-actions bot added the @aws-cdk/assert Related to the @aws-cdk/assert package label Sep 7, 2020
@NetaNir NetaNir closed this as completed Sep 7, 2020
@NetaNir NetaNir reopened this Sep 7, 2020
@nija-at nija-at added @aws-cdk/core Related to core CDK functionality and removed @aws-cdk/assert Related to the @aws-cdk/assert package labels Sep 17, 2020
@nija-at nija-at assigned rix0rrr and unassigned nija-at Sep 17, 2020
@nija-at nija-at changed the title [assert] Slow execution at SynthUtils.toCloudFormation on v1.57.0 [core] Slow execution at SynthUtils.toCloudFormation on v1.57.0 Sep 17, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 21, 2020

Investigating:

  • A lot of time is spent in collectRuntimeInformation (specifically: findNpmPackage).
  • Besides that, captureStackTrace in PostResolveToken is quite expensive (and we create A LOT of those).

The first finding will be addressed in #10306.

The second one is probably an easy enough fix. I thought we had disabled stack trace collection for tests using an environment variable. Maybe that change got reverted by accident?

rix0rrr added a commit that referenced this issue Sep 21, 2020
One of the contributors of longer runtimes, and we definitely
don't need stack traces in it.

Relates to #10213.
mergify bot pushed a commit that referenced this issue Sep 21, 2020
One of the contributors of longer runtimes, and we definitely
don't need stack traces in it.

Relates to #10213.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@eladb eladb removed their assignment Sep 21, 2020
@SomayaB SomayaB added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 22, 2020
@rix0rrr rix0rrr closed this as completed Oct 2, 2020
@github-actions
Copy link

github-actions bot commented Oct 2, 2020

⚠️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. investigating This issue is being investigated and/or work is in progress to resolve the issue.
Projects
None yet
Development

No branches or pull requests

6 participants