(Draft) Attempted performance improvements for interactive printer #2855
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.
This pull request is my way of documenting (and hopefully merging) various different attempts to improve the performance of the interactive printer. All benchmarks are run against a 100,000 line file containing 40 characters per line.
Change 1: Remove an unnecessary
String
clone.Change made in commit named "Replace clone with reference".
Over 2500 runs, this made a marginal increase in performance. It's not much, but every bit adds up.
❌ Change 2: Re-use the
line_buf
to reduce allocationsAs mentioned in #2544 (comment), I tried to re-use the line buffer when wrapping a line multiple times. Unfortunately, this resulted in a performance regression.