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

fix(js_parser): parse huge binary expressions #4856

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

arendjr
Copy link
Contributor

@arendjr arendjr commented Jan 8, 2025

Summary

Fixes #4563.

We used a recursive algorithm for parsing binary expressions, which triggered a stack overflow for huge expressions.

This PR changes the algorithm to be fully imperative instead. I also had to change our generated Debug implementations for nodes, because after I had fixed the parser, those triggered another overflow.

This PR looks huge, but it's really just the test cases.

Test Plan

Test added.

@arendjr arendjr requested review from a team January 8, 2025 13:51
@github-actions github-actions bot added A-Parser Area: parser A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages L-HTML Language: HTML L-Grit Language: GritQL labels Jan 8, 2025
Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Love it! Looks good.

Copy link

codspeed-hq bot commented Jan 8, 2025

CodSpeed Performance Report

Merging #4856 will not alter performance

Comparing arendjr:fix-recursive-binary-expressions (e78afdd) with next (bb065c4)

Summary

✅ 95 untouched benchmarks

@arendjr arendjr force-pushed the fix-recursive-binary-expressions branch from 6d98e2e to de4954f Compare January 8, 2025 14:52
@arendjr arendjr force-pushed the fix-recursive-binary-expressions branch from de4954f to e78afdd Compare January 8, 2025 14:55
@arendjr arendjr merged commit f064fd4 into biomejs:next Jan 8, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS L-Grit Language: GritQL L-HTML Language: HTML L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants