-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid rendering patch previews every frame
[Context and Fix] Patch previews can be rendered by external renderers, like `bat`, `delta`, and `diff-so-fancy`. However, this rendering is done for every frame and includes processing the whole patch being previewed through the renderer, then calling `into_text()` (from `ansi_to_tui` crate). Even though this whole process isn't too costly, making it at every frame results in ugly slowdowns for not so big patches (around 2000 lines after rendering). To fix this, move the whole rendering process to when we first instantiate a `PatchsetDetailsAndActions`, i.e., when consulting a patchset. [Collateral Effects] This basically solves the problem, however, there is still minor lag, due to ratatui `Paragraph` getting the whole file, and, for big series, there is a bit a loading when opening patchsets. Also, this does a bit of coupling of the model (`App`) with the view (`ratatui`). On the flipside, this collaterally fixes problems of wrong scroll calculations that happened because they considered the raw patches, not the rendered ones. Closes: #77 Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
- Loading branch information
1 parent
a2df8b1
commit 0fa6f9d
Showing
6 changed files
with
179 additions
and
175 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.