-
-
Notifications
You must be signed in to change notification settings - Fork 431
[Differ] Remove ConsoleDiffer, use DefaultDiffer that utilize ColorConsoleDiffFormatter instead to avoid double diffing process #7309
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
Conversation
…nsoleDiffFormatter instead to avoid double diffing process fix cs
|
All checks have passed 🎉 @TomasVotruba it is ready for review. |
…d by phpstan if any issue
|
my intial motivation for this change was performance. did you check whether this new implementation is faster then the previous one? |
|
Not yet check on a large diff. The check may need a large diff on a single run to see comparison, yes? |
|
IIRC the reproducer is described in rectorphp/rector#7899 |
|
I tried that, seems 1 second faster: Before After |
|
Updated stop loop on found --- Original and +++ New, got new result: Before After |
|
@samsonasik What are numbers on one if our private client's project? Real projects are better than Rector itself |
|
@TomasVotruba yes, the measure is depends on how many files changed, more diffs, more faster. I tried in our project with 70 files changed, that means there are diffs, it 3 seconds faster. Before After |
|
@TomasVotruba I've updated with reduce loop, remove array_map, and it seems faster 7 seconds now, applied 70 files changes, tested on our project: Before 2:05.41 After 1:58.40 |
|
Let's give it a try 👍 |
@staabm this is the rework effort from the old PR:
I tested with diff on json format, it keep same, see https://www.diffchecker.com/YtVb6oKF/
The process is:
DefaultDiffer->diff()as default valueFileDiff::__construct()ondiffConsoleFormatted, it calllike this:
Then, to keep the string
@@ @@, I use regex onColorConsoleDiffFormatter->diff().