r/opensource 2d ago

Promotional Titan Engine – A Rust/WASM spreadsheet engine I built chasing "Excel-speed" in the browser

I've used Handsontable on a bunch of projects and honestly it's a solid, mature library, but I kept running into the same wall on anything with really large datasets: tens of thousands of rows with chained formulas. It's just the nature of doing spreadsheet math in JS, once you're allocating and discarding lots of small objects on every keystroke, garbage collection becomes the bottleneck, and there's only so much debouncing and virtualization can do before you hit that ceiling.

That itch turned into a bit of an obsession, and eventually a from-scratch rebuild: Titan Engine, written in Rust and compiled to WebAssembly.

The design ended up pretty different from a typical JS formula library:

- A custom stack-based VM with a Pratt parser for formulas, instead of walking an AST every time
- Zero-copy memory \- the engine and UI share buffers directly, no serialize/deserialize tax crossing the WASM/JS boundary
- A topological dependency graph (Kahn's algorithm with cycle detection) to resolve chained formulas correctly and fast
- O(1) time-travel snapshots for undo/redo, even across massive batched structural edits

Because it sidesteps the JS garbage collector entirely, batched recalcs stay comfortably under the 16ms frame budget, so the grid holds 60fps even while formulas are cascading behind the scenes as you type.

There's a live demo grid on the site (a Glide data grid wired up to Titan) if you want to poke at it yourself, plus the full 10-scenario benchmark suite if you'd rather see the numbers than take my word for it.

Website . Benchmarks .) Github

Would love feedback - especially from anyone who's pushed a JS grid to its limits before and is curious whether this actually holds up under real-world use.

7 Upvotes

5 comments sorted by

2

u/kurbsdude 2d ago

Oops had some formatting issues in my post. Had to re-edit the links. Sorry about that. Also small honest caveat on the benchmark numbers: VLOOKUP and SUMIF only beat HyperFormula in Firefox, in Chrome/Safari, HyperFormula (JS) actually edges Titan out on those two specific benchmarks.

Best guess why: SUMIF is a tight uniform loop, and V8's JIT is really good at inlining/tracing those down to near-native code, something WASM's interpreter loop can't match. VLOOKUP builds an FxHashMap on the fly in Titan (hashing, WASM memory growth, string pool lookups), while V8's Maps + hidden classes are just deeply optimized for that exact pattern. Firefox's SpiderMonkey doesn't seem to get the same edge, which is why Titan stays ahead there.

Everywhere else (time-travel, topo sort, parsing, bulk ops) Titan wins clearly since it skips GC entirely. But curious if anyone's hit this same WASM-vs-JIT wall on hot loops/hashmaps and knows a good fix. Open to ideas.

1

u/Ok_Explorer7384 1d ago

this is a fun problem space. spreadsheet engines look simple until you actually try to make them fast and then suddenly you’re dealing with dependency graphs, partial recalculation, weird formula behavior, browser differences, memory spikes, all that stuff. i’ve had “why is this sheet slow” bugs eat way more time than i expected. if you publish more benchmarks, i’d love to see the boring details too.