NewCheck my Nemous content
Back
SS

ScienceStack

High-Performance LaTeX Paper Renderer

Architected a virtual list renderer for LaTeX papers as recursive JSON trees, achieving smooth rendering and near-zero memory footprint on 500+ page documents that previously crashed browsers.

500+ pages

Document size

Previously crashed browsers

Near-zero

Memory footprint

After virtualization

20 blocks

First render

Bootstrapped instantly

About this project

Built a high-performance renderer for LaTeX academic papers at ScienceStack, solving a hard problem: papers parsed as recursive JSON trees were crashing browsers on anything over a few hundred pages.

The root cause was a naive full-render approach that held the entire document in the DOM simultaneously. The fix required rethinking the rendering pipeline from the ground up.

I designed a tree-flattening algorithm that converts nested section structures into typed block arrays, separating inline from block tokens. This preserved the semantic hierarchy while enabling efficient virtualization, something recursive trees can't support directly.

On top of that, I built a progressive offscreen rendering strategy using React Fiber scheduling and idle callbacks. The first 20 visible blocks render instantly; the rest are pre-computed in the background without blocking the main thread.

Each block's measured DOM size gets committed into a persistent height map, making scroll position and rendering fully deterministic across any paper regardless of length.

The result: smooth scrolling and near-zero memory footprint on 500+ page documents, replacing a renderer that was actively crashing user browsers.

Tech stack

TypeScriptReactVirtual RenderingReact Fiber

Project link

Key achievements

Smooth rendering on 500+ page documents

Replaced a naive full-render that caused browser crashes with a virtual list renderer, achieving near-zero memory footprint on the largest papers.

Tree-flattening algorithm

Designed an algorithm converting nested LaTeX section structures into typed block arrays (inline vs. block tokens), enabling virtualization without losing semantic hierarchy.

Progressive offscreen rendering

Used React Fiber scheduling and idle callbacks to pre-compute block heights in the background, bootstrapping the first 20 visible blocks instantly.

Deterministic scroll and rendering

Committed measured DOM sizes into a persistent height map, making scroll position fully deterministic across any paper.