Skip to content

Router: absorb some penalty in single-line blocks#4851

Merged
kitbellew merged 2 commits intoscalameta:mainfrom
kitbellew:4851
Feb 28, 2025
Merged

Router: absorb some penalty in single-line blocks#4851
kitbellew merged 2 commits intoscalameta:mainfrom
kitbellew:4851

Conversation

@kitbellew
Copy link
Copy Markdown
Collaborator

No description provided.

@kitbellew kitbellew merged commit 4540bed into scalameta:main Feb 28, 2025
@kitbellew kitbellew deleted the 4851 branch February 28, 2025 12:43
kitbellew added a commit to kitbellew/scalafmt that referenced this pull request Mar 3, 2025
Rather than requiring that state cost remain unchanged with the latest
split, let's limit it to checking that the original cost of the split
(before any penalties may have been applied) is zero, and that the
state does not overflow.

This leads to extremely rare formatting changes (none on scala, spark,
scalafmt, scalameta repos) and on average over a 5% improvement in the
BestFirstSearch algorithm efficiency.

This approach protects optimal-token intentions from penalties which
are designed to rank different states, and is a follow-on to scalameta#4851.
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