Skip to content

Regex Improvements #4310

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jasonwilliams
Copy link
Member

@jasonwilliams jasonwilliams commented Jun 27, 2025

  • inline the take_while_ascii_pred function
  • change flag handling to stack allocation by using a fixed sized array
  • Parse regex literals at an earlier opportunity when inspecting expressions (to reduce stack depth)

- inline the take_while_ascii_pred function
- change flag handling to stack allocation by using a fixed sized array
- Parse regex literals at an earlier opportunity when inspecting expressions
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.

Project coverage is 50.31%. Comparing base (6ddc2b4) to head (1cb09f4).
Report is 460 commits behind head on main.

Files with missing lines Patch % Lines
core/parser/src/lexer/regex.rs 71.42% 8 Missing ⚠️
core/parser/src/lexer/cursor.rs 33.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4310      +/-   ##
==========================================
+ Coverage   47.24%   50.31%   +3.07%     
==========================================
  Files         476      498      +22     
  Lines       46892    49924    +3032     
==========================================
+ Hits        22154    25120    +2966     
- Misses      24738    24804      +66     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasonwilliams jasonwilliams added the run-benchmark Label used to run banchmarks on PRs label Jul 8, 2025
@jasonwilliams jasonwilliams removed the run-benchmark Label used to run banchmarks on PRs label Jul 8, 2025
@AdithyaLaakso
Copy link

I took your suggestion in the issues and made a new function for this issue using an arrayvec which I believe will be marginally more memory efficient in the vast majority of cases (where no flags are given) than allocating an array. Additionally, I added error handling for the case where more than 8 regex flags are added and preserved the original version of the function for future use.

However, your pull request covers a lot of area that mine does not we should merge them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants