Skip to content

Avoids recomputing LineEnding.toUnix in Formatter step loop#2934

Open
mirkoalicastro wants to merge 2 commits into
diffplug:mainfrom
mirkoalicastro:perf/formatter-reuse-normalized-content
Open

Avoids recomputing LineEnding.toUnix in Formatter step loop#2934
mirkoalicastro wants to merge 2 commits into
diffplug:mainfrom
mirkoalicastro:perf/formatter-reuse-normalized-content

Conversation

@mirkoalicastro
Copy link
Copy Markdown

In the core format loop, when a formatting step changes a file's content, the code used to normalize line endings to Unix twice in a row on the same content: once to compare, then again one more time to store. The loop runs once per step, per file. toUnix scans the whole file. This PR fixes it to reuse the first result instead of computing it a second time, with no changes in the behavior.

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.

1 participant