[pull] canary from vercel:canary#1086
Merged
Merged
Conversation
…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 ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )