Tackling split diff latency, synchronized horizontal scrolling, and building a focused personal pull request workspace.
Pull request reviews are where software engineering decisions are audited, tested, and recorded. Yet, if you spend your workday inside GitHub’s web interface reviewing pull requests spanning 40 or 50 files, you know the frustration: DOM trees grinding the browser to a halt, split diff columns sliding out of lockstep on horizontal trackpad pans, and notifications scattering your attention across dozen of browser tabs.
I built Praxd because I wanted pull request reviews to feel like editing code in a high-performance editor rather than navigating a cluttered social network.
In this deep dive, I want to unpack the technical challenges of re-engineering the pull request experience from the ground up: building a virtualized dual-column diff engine with synchronized 60fps horizontal and vertical panning, architecting a webhook-driven caching layer on top of PostgreSQL, and designing an ergonomic, keyboard-driven triage workflow.
The friction of GitHub's default PR interface
When reviewing a five-line typo fix, GitHub’s default interface is adequate. But modern development revolves around multi-package monorepos, automated dependency upgrades, and substantial architectural refactors. As pull request complexity scales, the limitations of standard web-based diff interfaces become glaringly apparent.
DOM node bloat and the 50-file cliff
GitHub’s diff view renders files directly into the DOM as static tables or lists of elements. In a pull request with 60 changed files and 3,500 lines of modified code, expanding all files can easily inject 80,000 to 120,000 DOM nodes into a single document.
Each line in a conventional split diff consists of line numbers, change indicators, syntax-highlighted token spans, and action triggers (such as line comment buttons). When you scroll:
- The browser's layout engine must continuously recalculate styles and geometry across thousands of elements.
- Memory consumption spikes past 800 MB on a single tab.
- Rapid vertical scrolling triggers dropped frames, jumping from a smooth 60fps down to an erratic 20–30fps.
- Expanding collapsed file blocks causes massive layout shifts and cumulative layout thrashing.
The desynchronization problem in split diffs
Split (side-by-side) diffs are the gold standard for reviewing complex changes because they let human eyes instantly correlate the old logic on the left with the new logic on the right. However, split diffs are notoriously difficult to implement reliably on the web.
The most common failure mode is scrolling desynchronization. If you implement a split diff by putting the base file in a left scroll container and the head file in a right scroll container, synchronizing them with standard scroll listeners (element.addEventListener('scroll', sync)) invariably breaks down:
- Scroll event throttling and lag: Browsers fire scroll events asynchronously or decouple them from the display refresh cycle. When trackpad inertia kicks in, the left and right containers update at slightly different frame timings, producing jitter and visual tearing.
- Line height deviations: When soft-wrapping is enabled, a single line of refactored code on the left might wrap into three visual lines, while the replacement on the right fits on one line. Without explicit spacer mechanics, every subsequent row below that line becomes misaligned.
- Horizontal drift: When lines exceed container width, horizontal trackpad gestures often pan only the hovered pane or apply uneven subpixel offsets to the opposite pane.
Context loss across rebased branches
During active reviews, authors push fixes, rebase against upstream main, or resolve conflicts. GitHub attempts to track changes across updates, but navigating between force-pushes often causes reviewers to lose their place. You are forced to re-read unmodified code blocks simply to verify whether a single comment was addressed.
Praxd was born out of the conviction that code review deserves a dedicated, distraction-free environment that treats pull requests as codebases in motion rather than forum threads.
Architectural philosophy of Praxd
Praxd was designed around three non-negotiable principles:
- Instant triage over social interaction: Reviews are a high-cognition engineering task. The UI strips away timeline noise, avatars, and unrelated widgets in favor of clean code viewports, unified file trees, and instant status signals.
- Strict 60fps virtualization: No matter whether a diff contains 10 lines or 15,000 lines across 200 files, the active DOM footprint must remain constant.
- Local-first responsiveness: Parsing, syntax highlighting, diff alignment, and navigation state must execute with sub-16ms latency. Remote network round-trips should never block keyboard navigation.
The technology stack powering Praxd reflects these priorities:
- Next.js & React 19: Server components for initial payload generation and optimized client boundary hydration.
- TypeScript: Strict type guarantees across the entire diff AST pipeline.
- Tailwind CSS: Zero-runtime utility styling keeping layout calculations lightweight.
- PostgreSQL: Relational storage for webhooks, content-addressable diff caches, and CI checks.
- Custom Git Diff Engine: Normalization algorithms producing unified row matrices for split rendering.
Solving lockstep split diff scrolling
To achieve completely locked, frame-accurate split scrolling, we had to reject the two-container model entirely.
The geometry of side-by-side diffs
A split diff cannot simply display two independent files side by side. It must display a single interleaved sequence of visual rows.
Consider a simple edit where two lines are removed and three lines are added:
Left (Base) Right (Head)
--------------------------------------------------------------
Row 1: const port = 3000; Row 1: const port = 8080;
Row 2: const host = "0.0.0.0" Row 2: const host = "127.0.0.1";
Row 3: [EMPTY SPACER] Row 3: const timeout = 5000;
Row 4: initServer(port, host) Row 4: initServer(port, host);If line 3 on the right has no counterpart on the left, the left column must be padded with a synthetic "spacer row" of identical height. If line 2 wraps to 40px on the left, the right column's row must also expand to 40px, even if its own text is only 20px tall.
The unified row matrix model
In Praxd, our diff parsing pipeline processes raw unified git patches and converts them into a DiffRowMatrix. Every entry in the matrix represents an exact, paired horizontal slice:
export type DiffLineType =
| "normal"
| "add"
| "delete"
| "spacer"
| "hunk-header"
export interface DiffToken {
type: string
value: string
}
export interface DiffLine {
lineNumber: number | null
type: DiffLineType
content: string
tokens: DiffToken[]
}
export interface DiffRow {
id: string
type: "code" | "hunk" | "collapsed-fold"
oldLine: DiffLine | null
newLine: DiffLine | null
height: number
}
export interface NormalizedDiffFile {
id: string
oldPath: string
newPath: string
status: "added" | "deleted" | "modified" | "renamed"
additions: number
deletions: number
rows: DiffRow[]
}By computing this paired matrix upfront, the rendering problem shifts from synchronizing two independent views to rendering a single array of DiffRow records.
Single master viewport with hardware-accelerated panning
Instead of having two scrolling elements, Praxd mounts a single virtualized scroll container. Both the left and right columns reside inside the exact same row container:
<div className="diff-viewport relative overflow-hidden" ref={viewportRef}>
<div
className="diff-virtual-canvas relative w-full"
style={{ height: `${totalVirtualHeight}px` }}
>
{virtualRows.map((virtualRow) => {
const row = diffRows[virtualRow.index]
return (
<SplitDiffRow
key={row.id}
row={row}
style={{
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: `${virtualRow.size}px`,
transform: `translateY(${virtualRow.start}px)`,
}}
horizontalOffset={scrollX}
/>
)
})}
</div>
</div>Vertical scrolling is handled natively by the virtualizer: as the user scrolls, only the 30–50 rows visible in the viewport are rendered in the DOM. When lines enter or leave the viewport, elements are recycled.
For horizontal scrolling, we enforce strict monospace font metrics with white-space: pre. To enable horizontal panning without breaking vertical lockstep, we intercept the horizontal component of the wheel/trackpad event and drive a CSS custom variable or hardware-accelerated transform:
// Hook to coordinate horizontal panning across both diff columns simultaneously
export function useSynchronizedPan(
containerRef: React.RefObject<HTMLDivElement | null>
) {
const [scrollX, setScrollX] = useState(0)
const maxScrollWidthRef = useRef(0)
useEffect(() => {
const element = containerRef.current
if (!element) return
const onWheel = (e: WheelEvent) => {
// Prioritize horizontal wheel deltas (Shift + Wheel or two-finger trackpad swipe)
const deltaX =
Math.abs(e.deltaX) > Math.abs(e.deltaY)
? e.deltaX
: e.shiftKey
? e.deltaY
: 0
if (deltaX === 0) return
e.preventDefault()
setScrollX((prev) => {
const next = prev + deltaX
const clamped = Math.max(0, Math.min(next, maxScrollWidthRef.current))
return clamped
})
}
element.addEventListener("wheel", onWheel, { passive: false })
return () => element.removeEventListener("wheel", onWheel)
}, [containerRef])
return {
scrollX,
setMaxScrollWidth: (w: number) => {
maxScrollWidthRef.current = w
},
}
}Inside the row component, both the left and right code columns apply transform: translate3d(-${horizontalOffset}px, 0, 0). Because both columns read from the same state and execute via GPU-accelerated 3D transforms, horizontal sliding is perfectly synchronized down to the subpixel level. Neither column can ever drift ahead or fall behind.
Code implementation: the virtualized diff row
Here is how the row renderer cleanly lays out both sides with gutter numbering, syntax highlighting, and spacer handling:
interface SplitDiffRowProps {
row: DiffRow
style: React.CSSProperties
horizontalOffset: number
}
export function SplitDiffRow({
row,
style,
horizontalOffset,
}: SplitDiffRowProps) {
if (row.type === "hunk") {
return (
<div
style={style}
className="flex items-center border-y border-border/40 bg-muted/40 px-4 font-mono text-xs text-muted-foreground select-none"
>
<span>{row.oldLine?.content}</span>
</div>
)
}
return (
<div
style={style}
className="flex w-full divide-x divide-border/40 font-mono text-xs leading-5 select-text"
>
{/* Left Pane (Base file) */}
<div className="flex w-1/2 overflow-hidden bg-background">
<div className="w-12 shrink-0 bg-muted/10 pr-3 text-right text-muted-foreground/50 select-none">
{row.oldLine?.lineNumber ?? ""}
</div>
<div
className={cn(
"flex-1 px-2 whitespace-pre will-change-transform",
row.oldLine?.type === "delete" &&
"text-destructive-foreground bg-destructive/15",
row.oldLine?.type === "spacer" && "bg-muted/5 select-none"
)}
style={{ transform: `translate3d(-${horizontalOffset}px, 0, 0)` }}
>
{row.oldLine?.tokens.map((token, i) => (
<span key={i} className={`token-${token.type}`}>
{token.value}
</span>
))}
</div>
</div>
{/* Right Pane (Head file) */}
<div className="flex w-1/2 overflow-hidden bg-background">
<div className="w-12 shrink-0 bg-muted/10 pr-3 text-right text-muted-foreground/50 select-none">
{row.newLine?.lineNumber ?? ""}
</div>
<div
className={cn(
"flex-1 px-2 whitespace-pre will-change-transform",
row.newLine?.type === "add" &&
"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",
row.newLine?.type === "spacer" && "bg-muted/5 select-none"
)}
style={{ transform: `translate3d(-${horizontalOffset}px, 0, 0)` }}
>
{row.newLine?.tokens.map((token, i) => (
<span key={i} className={`token-${token.type}`}>
{token.value}
</span>
))}
</div>
</div>
</div>
)
}Real-time PR inbox and GitHub App webhooks
A diff viewer is only as good as the freshness of its underlying data. If you have to wait 10 seconds for GitHub's REST API to fetch commits, generate diffs, and fetch review statuses, the UX falls flat.
Praxd operates as a registered GitHub App installed across user repositories. Instead of fetching data on demand when you open a link, Praxd maintains a hot cache in PostgreSQL backed by asynchronous webhook event streaming.
Webhook ingestion and event routing
When an engineer opens a pull request, updates a branch, or leaves a comment, GitHub fires a webhook payload to Praxd's ingestion endpoint.
We parse and process five core events:
pull_request.opened/pull_request.synchronize: Triggers a background diff fetch, normalizes the hunks into our row matrix, and persists the result.check_suite/check_run: Updates CI status badges (running, failed, succeeded) with commit-level granularity.pull_request_review: Syncs approval states and reviewer requests.pull_request_review_comment: Ingests inline code comments into a local thread tree.
// Route handler for GitHub App webhooks
export async function POST(req: Request) {
const payload = await req.json()
const event = req.headers.get("x-github-event")
const signature = req.headers.get("x-hub-signature-256")
if (!verifyWebhookSignature(payload, signature)) {
return new Response("Invalid signature", { status: 401 })
}
switch (event) {
case "pull_request":
await handlePullRequestEvent(payload)
break
case "check_run":
await handleCheckRunEvent(payload)
break
case "pull_request_review":
await handleReviewEvent(payload)
break
}
return new Response("OK", { status: 200 })
}Content-addressable diff caching with PostgreSQL
Diffs between two git commits are mathematically immutable. If base SHA is a719c8 and head SHA is f24e1b, the diff will never change.
We leverage this property to build a content-addressable cache in PostgreSQL:
CREATE TABLE diff_cache (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
repo_id BIGINT NOT NULL,
base_sha VARCHAR(40) NOT NULL,
head_sha VARCHAR(40) NOT NULL,
parsed_payload JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT unq_repo_shas UNIQUE (repo_id, base_sha, head_sha)
);
CREATE INDEX idx_diff_cache_lookup ON diff_cache (repo_id, base_sha, head_sha);When a reviewer opens a pull request in Praxd:
- The client requests the diff for
base_shaandhead_sha. - The database query hits
idx_diff_cache_lookupand returns the pre-calculated, syntax-highlightedJSONBAST in under 5ms. - The server sends compressed JSON directly over HTTP with an aggressive
stale-while-revalidatecaching header. - If a cache miss occurs (e.g., initial install), Praxd fetches the raw diff via the GitHub Git Data API, parses it through our worker pool, stores it in PostgreSQL, and streams the response simultaneously.
Automated CI check orchestration
Nothing disrupts review flow more than switching tabs to see if tests passed. Praxd aggregates all GitHub Actions, CircleCI, or external checks into an active status bar.
Through PostgreSQL triggers and lightweight Server-Sent Events (SSE), when a failed test run completes, the interface updates the specific commit indicator instantly without requiring a page refresh.
Keyboard-first workflow
Developer tools should never force your hands off the keyboard. Praxd provides a complete modal navigation system inspired by VIM and modern code editors.
Reviewing at the speed of thought
| Shortcut | Action |
|---|---|
j / k | Navigate down / up through diff hunks or lines |
n / p | Jump to next / previous changed file in the tree |
v | Toggle between Split and Unified diff modes |
c | Open inline review comment draft at active line |
Tab | Toggle the file tree sidebar |
Space | Mark current file as viewed and collapse |
Shift + Enter | Submit batch review (Approve / Request Changes) |
The keyboard action dispatcher
Handling single-key shortcuts in complex web apps often leads to bugs where typing an "input" field accidentally triggers global shortcuts. Praxd implements an isolated action dispatcher that respects input focus and modal states:
export function useDiffKeyboardShortcuts({
onNextHunk,
onPrevHunk,
onNextFile,
onPrevFile,
onToggleView,
onAddComment,
onToggleSidebar,
}: ShortcutHandlers) {
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Ignore key events if the user is typing in a textarea, input, or contentEditable element
const target = e.target as HTMLElement
const isInput =
target.tagName === "INPUT" ||
target.tagName === "TEXTAREA" ||
target.isContentEditable
if (isInput) return
// Don't intercept native browser modifier shortcuts (Cmd/Ctrl + C, Cmd + R, etc.)
if (e.metaKey || e.ctrlKey || e.altKey) return
switch (e.key) {
case "j":
e.preventDefault()
onNextHunk()
break
case "k":
e.preventDefault()
onPrevHunk()
break
case "n":
e.preventDefault()
onNextFile()
break
case "p":
e.preventDefault()
onPrevFile()
break
case "v":
e.preventDefault()
onToggleView()
break
case "c":
e.preventDefault()
onAddComment()
break
case "Tab":
e.preventDefault()
onToggleSidebar()
break
}
}
window.addEventListener("keydown", handleKeyDown)
return () => window.removeEventListener("keydown", handleKeyDown)
}, [
onNextHunk,
onPrevHunk,
onNextFile,
onPrevFile,
onToggleView,
onAddComment,
onToggleSidebar,
])
}This ensures zero-latency command execution while protecting the author from inadvertent key actions during comment composition.
Benchmarks and real-world results
To measure the impact of virtualized rendering and content-addressable caching, we conducted performance benchmarks comparing GitHub’s default web interface against Praxd.
Performance comparison on a 4,200-line diff
The test benchmark was conducted on a mid-sized monorepo pull request consisting of 54 changed files, 3,120 additions, and 1,080 deletions (total 4,200 lines). The tests were run in Chrome 124 on an Apple M2 machine with 16 GB of unified memory.
| Metric | GitHub Web PR Interface | Praxd Diff Engine | Improvement |
|---|---|---|---|
| Initial page load & parse time | 3,420 ms | 280 ms | 12.2x faster |
| Active DOM nodes (full diff open) | 94,520 nodes | 1,480 nodes | 98.4% reduction |
| Memory footprint (Heap) | 782 MB | 68 MB | 91.3% reduction |
| Average scroll frame rate (60Hz target) | 28–34 fps (frequent jank) | 59–60 fps (rock solid) | Smooth 60fps |
| Split diff horizontal desync rate | High on fast trackpad swipes | 0% (mathematically locked) | Completely eliminated |
| File-to-file switch latency | 450–700 ms | 8–14 ms | 35x faster |
Why virtualization changes everything
The benchmark numbers highlight an inescapable reality of modern web rendering: the DOM was never intended to serve as a massive in-memory document database.
By restricting DOM creation strictly to what is currently visible on the physical screen (plus an overscan buffer of roughly 10 rows above and below), Praxd keeps layout costs bounded. When you have 1,480 nodes instead of 94,000, style recalculation takes under 1ms instead of 45ms per frame. The browser can easily render every frame within its 16.6ms window, yielding an effortlessly responsive interaction model.
Lessons learned and the road ahead
Building Praxd reinforced several key software engineering principles:
- Do not fight the browser engine: When building complex interactive components like side-by-side diff viewers, trying to coordinate two independent native scroll containers via JavaScript callbacks is an architectural anti-pattern. Unifying geometry into a single virtualizer eliminates whole classes of synchronization bugs.
- Immutability enables aggressive caching: Because commit SHAs are immutable, diff processing can be treated as pure functions. Once a diff is tokenized and stored in PostgreSQL, it can be served instantly for all future review sessions.
- Ergonomics compound: Shaving 300ms off file switches and providing single-key navigation creates an intangible but profound difference in daily developer happiness. A reviewer can parse through 50 files in a fraction of the time, keeping mental flow intact.
Praxd is available as open source at github.com/abushaidislam/praxd.
The roadmap ahead includes offline review support backed by local git mirrors, AI-assisted change grouping that clusters related edits across disparate files, and collaborative multiplayer cursors for live paired code reviews.
If you spend multiple hours every week reviewing pull requests, give Praxd a spin—your browser's memory and your review velocity will thank you.