Merged
Conversation
This was referenced Aug 14, 2023
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
01d0c1d to
008773a
Compare
e755341 to
222bf7d
Compare
Member
Author
|
It may be interesting to see if we can come up with a good heuristic for the |
Contributor
PR Check ResultsBenchmarkLinuxWindows |
konstin
approved these changes
Aug 14, 2023
Member
konstin
left a comment
There was a problem hiding this comment.
nice!
what i really want to benchmark is how many % extra we need to cover >95% reformattings too
008773a to
70c5ff5
Compare
222bf7d to
a97a59a
Compare
Merged
70c5ff5 to
206b837
Compare
a97a59a to
3076d97
Compare
206b837 to
301fe5c
Compare
3076d97 to
2db43a5
Compare
2db43a5 to
493a3b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
I did some profiling on the formatter and noticed that we end up growing the
Printerbuffer multiple times. This PR tries to reduce the number of times that we need to grow the formatted string buffer by allocating a buffer of the same size as the unformatted document.This should be a good default because most files in a project are already formatted (we neither allocate too much nor too little).
Test Plan
This improved the formatter time by about 2%
cargo test