Rewrite 'Remove consecutive duplicate lines' to not use regex #13558
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #5538 and #12548.
Files for test and results:
uniq_list.zip from #5538 (comment) - something around 2.7 million lines
In my machine I got 20s (new implementation) vs 70s (old implementation).
Unix (LF) 44073 lines file from #5538 (comment)
In this example we have problem with processing many lines at once when using regex (the line with
EXECUTE
as content). The new implementation does not have such problem and is also faster.I tried to recreate the current behavior of this method. Now we have more control over the whole thing, so if something is not working properly, we can correct it. It might be even faster if we delete all the lines at once, but that would affect the state of the lines that are supposed to stay, so I don't do this (as in the previous commands).
Other commands that also use regex with a limit can be modified in a similar way. But so far we don't have any reported issues for them so that's a task for the future.