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 instances of exponential backtracking found by recheck #5144

Merged
merged 1 commit into from
May 8, 2023

Conversation

nightwing
Copy link
Member

@nightwing nightwing commented Apr 27, 2023

https://www.npmjs.com/package/recheck is able to find slow regexps in many cases. It helped to find two instances of such behavior. Unfortunately it is not fast enough to run after each pull request, so i've commented out the test code, but perhaps it is worth to add a separate workflow to run recheck only for changed mode files.

@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Patch coverage: 23.07% and project coverage change: -0.27 ⚠️

Comparison is base (6f60229) 86.94% compared to head (948d9a5) 86.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5144      +/-   ##
==========================================
- Coverage   86.94%   86.68%   -0.27%     
==========================================
  Files         560      560              
  Lines       44220    44199      -21     
  Branches     6854     6850       -4     
==========================================
- Hits        38446    38312     -134     
- Misses       5774     5887     +113     
Flag Coverage Δ
unittests 86.68% <23.07%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/mode/clojure_highlight_rules.js 100.00% <ø> (ø)
src/mode/ion_highlight_rules.js 100.00% <ø> (ø)
src/mode/_test/highlight_rules_test.js 58.77% <16.66%> (-6.76%) ⬇️
src/mode/raku_highlight_rules.js 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nightwing nightwing force-pushed the recheck branch 4 times, most recently from 31199c9 to fdea2bb Compare April 30, 2023 19:01
Comment on lines 262 to 263
checkBacktracking(tokenizer);
// TODO this is too slow to run in regular tests
// checkBacktracking(tokenizer);
Copy link
Contributor

Choose a reason for hiding this comment

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

checkBacktracking function implementation did not change - why do we need to comment it out? checkBacktrackingWithRecheck is what seems to be slow based on your comments, and it's not used anywhere, so we don't need to comment out checkBacktracking as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

checkBacktracking was my naive attempt to implement something similar to recheck, when it was not available yet. It had too many false positives and was needlessly cluttering test output with warnings that no one was reading. We probably should remove it entirely.

@nightwing nightwing force-pushed the recheck branch 2 times, most recently from 0d34f5b to 9dd82df Compare May 8, 2023 14:48
@nightwing nightwing merged commit c6ec82c into master May 8, 2023
@nightwing nightwing deleted the recheck branch May 8, 2023 16:02
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