Printer: Slice based queue and stack#6819
Merged
MichaReiser merged 1 commit intomainfrom Aug 24, 2023
Merged
Conversation
This was referenced Aug 23, 2023
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Contributor
PR Check ResultsBenchmarkLinuxWindows |
2016aae to
cfe1ec1
Compare
a15564f to
92ce7de
Compare
cfe1ec1 to
2bf05e3
Compare
2bf05e3 to
1d3b4a1
Compare
Merged
Member
|
The CI benchmarks look like a perf regression |
Member
Author
I need to merge the baseline PR first. I believe our benchmark always compares against main |
1d3b4a1 to
d5d89a0
Compare
konstin
approved these changes
Aug 24, 2023
Member
konstin
left a comment
There was a problem hiding this comment.
lgtm, given that perf doesn't regress anymore with the new numbers from main
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
This PR refactors the
StackandQueueimplementations in the Printer to usestd::slice::Iterinstead of aslice+ offset pointer.This results in a 3% size reduction:
print_element-> more aggressive inliningruff_formatter ruff_formatter::printer::call_stack::CallStack::top_kind7 byte reduction (relatively hot)ruff_formatter ruff_formatter::printer::queue::Queue::extend_backdown to a single item and 78 bytesMain
This PR
Test Plan
cargo test