Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: aws/constructs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.7.0
Choose a base ref
...
head repository: aws/constructs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.7.1
Choose a head ref
  • 1 commit
  • 1 file changed
  • 3 contributors

Commits on Jul 20, 2026

  1. fix: Node.path takes a lot of time on deep construct trees (#2873)

    Every construct has a `Node`, and `Node.path` and `Node.scopes` are
    computed on every access by
    walking the full scope chain up to the root and joining the component
    ids.
    
    These values never change once the construct is created, so we can just
    eagerly
    calculate them instead. The lazy work was predicated on the assumption
    that they might only rarely be read, but in practice CDK synthesis reads
    both properties contstantly, and recalculating them incurs a heft cost 
    on deep construct trees.
    
    The
    most impactful case is the aspect invocation loop in `aws-cdk-lib`
    (`invokeAspectsV2`), which recurses the whole tree until it stabilizes
    and
    uses `node.path` as a per-node dedup-map key on every visit. On a large
    tree
    (~5,500 stacks) this was measured at hundreds of millions of `path`
    reads in a
    single synth, dominating both CPU and GC.
    
    This had a pretty nice performance benefit on a CDK package of ours, the
    synthesis times went from around 15 minutes to 8 minutes.
    
    ### Testing
    
    `yarn test` (full jest suite) passes.
    
    ---------
    
    Co-authored-by: Richard Kirk <[email protected]>
    Co-authored-by: Rico Huijbers <[email protected]>
    3 people authored Jul 20, 2026
    Configuration menu
    Copy the full SHA
    857a94f View commit details
    Browse the repository at this point in the history
Loading