-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
readline: replace quadratic regex with linear one #26778
Conversation
my 2 bits: I think the test should assert it functions correctly, but not the time complexity of the code. So, testing input designed to trigger quadratic isn't necessary, IMO, but if the test is fast, its not bad to do. A comment as to why the code is written this way would be useful, so someone doesn't come along later and think "aha, I can refactor this into one line with a better regex". |
Added a comment and updated the test. |
Simplify regular expression in _wordLeft readline method.
Landed in e4e2b0c |
Simplify regular expression in _wordLeft and _deleteWordLeft readline methods. PR-URL: #26778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Simplify regular expression in _wordLeft and _deleteWordLeft readline methods. PR-URL: #26778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Simplify regular expression in _wordLeft and _deleteWordLeft readline methods. PR-URL: #26778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Simplify regular expression in _wordLeft and _deleteWordLeft readline methods. PR-URL: #26778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Simplify regular expression in _wordLeft readline method.
Note: If the test can be improved in any way, let me know. Tried using
FakeInput
, but writing one million characters takes a very long time. Or should a benchmark be used instead of the test?Fixes #26596
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes