Skip to content

perf: last line render caching#20

Open
mrsobakin wants to merge 1 commit into
lajarre:mainfrom
mrsobakin:perf/last-line-caching
Open

perf: last line render caching#20
mrsobakin wants to merge 1 commit into
lajarre:mainfrom
mrsobakin:perf/last-line-caching

Conversation

@mrsobakin
Copy link
Copy Markdown

@mrsobakin mrsobakin commented May 7, 2026

pi-vim was rerendering last line on each frame, calling an expensive truncateToWidth function. This commit adds caching, which halves the render time.

Also, as a nice bonus, upstream callers can match their cache faster, since when lastLine does not change, it literally stays the exact same object, which allows for fast by-reference string comparison.

Before (pi-vim's render takes half of the frame time):

image

After (pi-vim is fully cached, takes ~0 time):

image

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.

1 participant