perf: faster web delivery, smaller diffs, windowed conflicts - #32
Merged
Merged
Conversation
Static files are held in memory (revalidated by mtime) with lazy Brotli/gzip variants and strong ETags; hashed /assets/* are immutable, everything else is no-cache with 304s. Large /invoke JSON is compressed asynchronously. The renderer bundle is now minified (electron-vite defaults minify to false). Phone (Fast 3G, CPU x4): cold load 12.7 s / 2.26 MB -> 2.8 s / 249 KB.
…both Modified text diffs no longer carry oldContent; the renderer rebuilds old-side lines from newContent + hunks. Lazy block highlighting moves to lib/highlight so the conflict view can share it, and its cache now resets when the old side changes.
ConflictDiff mounted and highlighted every line; it now uses useWindowedRows and lazy block highlighting. A 5,400-line conflict mounts 66 lines instead of 5,400.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes from the performance audit (server mode on phones, large diffs, conflicts, startup, watcher).
Measured
/invokeDiff compression was measured on a synthetic, highly repetitive file; expect roughly 5–10× on real code.
Changes
immutablefor hashed/assets/*,no-cacheelsewhere./gitgood-bridge.jsand/invokestayno-store. Large/invokeJSON compressed asynchronously.minify: 'esbuild'; electron-vite defaults it off).oldContent;reconstructOldLinesrebuilds the old side fromnewContent+ hunks. Covered bytest/diff-reconstruct.test.tsagainst realgit diffoutput (CRLF, no EOL at EOF, deletion at start, multi-hunk, rename).useWindowedRows; lazy block highlighting extracted tolib/highlight.tsand shared withTextDiff(its cache now also resets when the reconstructed old side changes)./invoke, the bridge,/versionor/events.Verification
npm run typecheck,npm run build,npx vitest run: 90 files, 1,121 passed, 4 skipped.Not done: the 40k-line diff still takes ~1.5 s, which is
git diffitself; the spinner now covers it.