Text reflow performance #2 #520

Manually merged
dnkl merged 2 commits from reflow-performane-no-new-row-initialization into master 7 months ago
dnkl commented 7 months ago
Owner

This builds on top of #519

  • Don't zero-initialize the cells of freshly allocated rows
  • Don't zero-initialize the cells of rows re-used from the scrollback
  • Free rows from the old grid one by one "as we go", rather than all at once at the end

The first two points directly affect the time it takes to reflow the grid; zero-initializing new rows is completely unnecessary since they'll immediately get overwritten. There are two exceptions to this: one, rows with a hard line break. Here we need to "manually" clear the remaining cells when we insert the line break. Two, the last row may only be partially written. Here too, we need to clear the remaining cells.

The last point reduces our memory foot print, as we no longer need to hold both the old and the new grid, in their entirety, in memory at the same time. May also improve performance due to slightly better cache behavior (but I doubt it).

This builds on top of https://codeberg.org/dnkl/foot/pulls/519 * Don't zero-initialize the cells of freshly allocated rows * Don't zero-initialize the cells of rows re-used from the scrollback * Free rows from the old grid one by one "as we go", rather than all at once at the end The first two points directly affect the time it takes to reflow the grid; zero-initializing new rows is completely unnecessary since they'll immediately get overwritten. There are two exceptions to this: one, rows with a hard line break. Here we need to "manually" clear the **remaining** cells when we insert the line break. Two, the _last_ row may only be partially written. Here too, we need to clear the **remaining** cells. The last point reduces our memory foot print, as we no longer need to hold both the old and the new grid, in their entirety, in memory at the same time. _May_ also improve performance due to slightly better cache behavior (but I doubt it).
dnkl added the
performance
label 7 months ago
dnkl force-pushed reflow-performane-no-new-row-initialization from d8905cf758 to 7731f4b4a4 7 months ago
dnkl changed target branch from reflow-performance to master 7 months ago
dnkl force-pushed reflow-performane-no-new-row-initialization from 7731f4b4a4 to 1aa4a31c6f 7 months ago
dnkl merged commit ed60c66522 into master manually 7 months ago
The pull request has been manually merged as ed60c66522.
Sign in to join this conversation.
Loading…
There is no content yet.