Skip to content

Optimize diff view rendering - #53

Merged
bennekrouf merged 1 commit into
mainfrom
feat/diff-view-optimizations
Sep 5, 2026
Merged

Optimize diff view rendering#53
bennekrouf merged 1 commit into
mainfrom
feat/diff-view-optimizations

Conversation

@bennekrouf

Copy link
Copy Markdown
Owner

What changed

  • Optimized the diff view rendering by precomputing and caching the syntax highlighting of diffs.
  • Introduced a new RenderedFile struct to store pre-rendered diff files.
  • Updated the DiffView component to use the pre-rendered diffs.
  • Improved the drive function in workspace.rs to handle approvals more efficiently and reduce unnecessary polling.
  • Enhanced the commit function in flow.rs to handle paths to stage more accurately and avoid unnecessary operations.
  • Refactored the status function in git.rs to use git status --porcelain -z for better handling of file paths.
  • Added tests for the new rendering logic and other changes.

Why

  • The previous diff rendering approach was inefficient, re-parsing and highlighting the entire diff on every render, leading to performance issues, especially with large diffs.
  • The new approach reduces the computational load by parsing and highlighting the diff only once and reusing the result.
  • Improvements in the drive function and commit function enhance the responsiveness and efficiency of the application.

How to test

  • Open the diff view for a large file or a repository with multiple changes.
  • Observe that the rendering is smooth and does not lag.
  • Navigate to the workspace screen and trigger a commit.
  • Verify that the commit process is efficient and does not involve unnecessary operations.
  • Check the status of a repository with special characters in file names to ensure proper handling.

@bennekrouf
bennekrouf merged commit daed6e7 into main Sep 5, 2026
1 of 2 checks passed
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