Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Draft) Attempted performance improvements for interactive printer #2855

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eth-p
Copy link
Collaborator

@eth-p eth-p commented Feb 12, 2024

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".

image

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 allocations

As 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.

image

This avoids an unnecessary allocation and memory copy
when printing the empty panel during line wrapping.
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.

None yet

1 participant