boa icon indicating copy to clipboard operation
boa copied to clipboard

Regex Improvements

Open jasonwilliams opened this issue 6 months ago • 2 comments

  • 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)

jasonwilliams avatar Jun 27 '25 23:06 jasonwilliams

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 :warning:
core/parser/src/lexer/cursor.rs 33.33% 6 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Jul 08 '25 19:07 codecov[bot]

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!

AdithyaLaakso avatar Aug 05 '25 03:08 AdithyaLaakso