Skip to content

fix(core): default stack trace size adds unnecessary overhead#37827

Merged
mergify[bot] merged 2 commits into
mainfrom
huijbers/save-time-stacktracin
May 13, 2026
Merged

fix(core): default stack trace size adds unnecessary overhead#37827
mergify[bot] merged 2 commits into
mainfrom
huijbers/save-time-stacktracin

Conversation

@rix0rrr
Copy link
Copy Markdown
Contributor

@rix0rrr rix0rrr commented May 11, 2026

By default, the CDK library captures the largest possible stack trace whenever stack traces are captured. Capturing the default stack trace size (10 frames) configured using --stack-trace-limit saves ~50% of the time spent in stack trace collection.

This saves ~200ms on ~8500 constructs in one sample application, while leaving the user in control.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

By default, the CDK library captures the largest possible stack trace
whenever stack traces are captured. Capturing the default stack trace
size (10 frames) configured using `--stack-trace-limit` saves ~50% of
the time spent in stack trace collection.

This saves ~200ms on ~8500 constructs in one sample application, while
leaving the user in control.
@rix0rrr rix0rrr requested a review from a team as a code owner May 11, 2026 11:33
@rix0rrr rix0rrr added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels May 11, 2026
@github-actions github-actions Bot added the p2 label May 11, 2026
@rix0rrr rix0rrr changed the title fix(aws-cdk-lib): default stack trace size is slow fix(aws-cdk-lib): default stack trace size adds unnecessary overhead May 11, 2026
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label May 11, 2026
@mergify mergify Bot temporarily deployed to automation May 11, 2026 11:34 Inactive
@mergify mergify Bot temporarily deployed to automation May 11, 2026 11:34 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

⚠️ This pull request description does not follow the correct template structure.

PRs without a linked issue will receive lower priority for review and merging. Please update the description to follow the PR template and include a line like Closes #123 in the Issue section. If no existing issue matches your change, create one first.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 11, 2026
@rix0rrr rix0rrr changed the title fix(aws-cdk-lib): default stack trace size adds unnecessary overhead fix(core): default stack trace size adds unnecessary overhead May 13, 2026
Copy link
Copy Markdown
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good, but one question for clarification:

Q: This only happens when --debug is enabled, correct?

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 13, 2026
@rix0rrr
Copy link
Copy Markdown
Contributor Author

rix0rrr commented May 13, 2026

Q: This only happens when --debug is enabled, correct?

Not entirely. Construct creation is always traced, even without --debug. Property mutations are only traced when --debug is set.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 13, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 13, 2026

Merge Queue Status

  • Entered queue2026-05-13 11:53 UTC · Rule: default-squash
  • Checks passed · in-place
  • Merged2026-05-13 12:40 UTC · at 3c3e8864b1928773ae6bc40c4d091456c58e336e · squash

This pull request spent 47 minutes 28 seconds in the queue, including 47 minutes 2 seconds running CI.

Required conditions to merge

@mergify mergify Bot temporarily deployed to automation May 13, 2026 11:53 Inactive
@mergify mergify Bot temporarily deployed to automation May 13, 2026 11:53 Inactive
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 13, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify Bot merged commit 0b1fb2b into main May 13, 2026
19 of 20 checks passed
@mergify mergify Bot deleted the huijbers/save-time-stacktracin branch May 13, 2026 12:40
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants