Skip to content

[pull] canary from vercel:canary#1086

Merged
pull[bot] merged 4 commits into
code:canaryfrom
vercel:canary
May 30, 2026
Merged

[pull] canary from vercel:canary#1086
pull[bot] merged 4 commits into
code:canaryfrom
vercel:canary

Conversation

@pull

@pull pull Bot commented May 30, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

sampoder added 4 commits May 29, 2026 21:24
…94211)

This PR breaks up the large `graph.rs` file into a file for effects, a
file for `EvalContext`, and a file for the visitor. `graph.rs` still
exists but is much smaller than before.
…lKnownFunctionKind` (#94217)

Suggested by @bgw in
#94208 (comment);
now, implemented!
)

Previously, these were unknown / unsupported expressions:
```
Unknown {
    original_value: None,
    reason: "unsupported expression",
    has_side_effects: true,
},
```

This prevented us from folding `-1 === -1` into true, for example. Most
of this PR's changes are updates to the snapshot. It exists in this
stack because the code it touches was moved in the stack.
… in the analyzer (#94221)

@lukesandberg and I were looking at the call stack for the analyzer this
morning and we talked about how we appeared to be spending a lot of time
calculating the kind of each node's parent, see:

<img width="939" height="291" alt="Screenshot 2026-05-29 at 12 24 41 AM"
src="https://github.com/user-attachments/assets/1f9d2c02-0a49-4e33-8107-626791e85ba1"
/>

Interestingly, SWC also appears to be calculating this information based
on the call stack. And it appears that SWC's [`AstNodePath`'s `kinds()`
method](https://rustdoc.swc.rs/swc_common/pass/struct.AstNodePath.html#method.kinds)
is a pre-computed version of what we were computing. This PR switches us
to using that method to see if there any potential performance benefits.

I think I need a little bit of help benchmarking this more but running:

```
cargo bench --manifest-path /Users/sampoder/dev/next.js/Cargo.toml  -p turbopack-ecmascript --bench analyzer  -- --baseline orig 'create_graph/(peg|react-dom-production|md5)'
```

First on the branch without this switch, and then on this branch
suggests improvements:

```
analyzer/create_graph/md5
                        time:   [109.87 µs 110.24 µs 110.59 µs]
                        change: [-3.3365% -2.7341% -2.1580%] (p = 0.00 < 0.05)
                        Performance has improved.
analyzer/create_graph/peg
                        time:   [1.3740 ms 1.3813 ms 1.3887 ms]
                        change: [-8.4332% -7.7685% -7.1580%] (p = 0.00 < 0.05)
                        Performance has improved.
analyzer/create_graph/react-dom-production
                        time:   [2.9095 ms 2.9319 ms 2.9553 ms]
                        change: [-17.616% -16.642% -15.677%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  7 (7.00%) high mild
analyzer/create_graph/md5-reduced
                        time:   [26.658 µs 26.725 µs 26.794 µs]
                        change: [-5.7610% -5.2585% -4.7925%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
analyzer/create_graph/md5_2
                        time:   [109.99 µs 110.30 µs 110.64 µs]
                        change: [-9.0036% -8.5102% -8.0469%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
```
@pull pull Bot locked and limited conversation to collaborators May 30, 2026
@pull pull Bot added the ⤵️ pull label May 30, 2026
@pull pull Bot merged commit 2bbb67b into code:canary May 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant