Titan is a headless spreadsheet engine implemented in Rust and compiled to WebAssembly, built to recalculate large sheets in the browser without heavy JavaScript allocation or costly serialization across the WASM boundary. It ships with a TitanJS wrapper that exposes A1 notation, an event subscription model that emits precise change lists for UI layers, batch operations for bulk updates, and a Viewport abstraction that provides zero-copy, pointer-based reads into WASM memory. The package is available on NPM and includes benchmarks and documentation demonstrating a focus on runtime throughput and low-latency UI integration rather than strict Excel compatibility.
Internally, Titan uses a memory-efficient struct-of-arrays layout partitioned into 32×32 chunks to keep data contiguous and cache-friendly. Formulas compile to bytecode executed by a stack VM; ranges are lazily referenced and capped to avoid huge allocations, and dependency updates use Kahn’s topological algorithm to detect cycles and surface errors instead of freezing the main thread. Strings are interned with reference counting, cell values use a typed enum to propagate errors correctly, and the standard library implements 42 functions across math, logic, lookup, conditional aggregation, text, and date domains. The design emphasizes zero-copy crossing of the JS/WASM boundary and predictable, GC-friendly behavior for interactive web spreadsheets.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.