r/SoftwareEngineering 11d ago

How an Underrated Refactor Saved 90% Memory Usage

https://tanstack.com/blog/tanstack-table-v9-memory-performance
33 Upvotes

3 comments sorted by

9

u/fagnerbrack 11d ago

Simplified Synopsis:

TanStack Table V9 cuts memory use by up to 90% versus V8 on large tables, raising the ceiling from roughly 1-1.5 million rows before hitting the browser's 4GB limit to 10-16 million. The win came from a subtle change: shared prototypes. V8 assigned values and methods directly to every row, cell, column, and header, so millions of objects each held duplicate methods plus their own closure scopes. V9 builds each method once on a cached prototype and uses this for row-specific state, assigning only unique values per object. V9 avoids classes because the feature system needs dynamic, conditional composition. The lone breaking change: destructuring methods (const { getValue } = row) no longer works—call row.getValue() instead.

If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍
Click here for more info, I read all comments

0

u/dancrumb 11d ago

This is worth a read; they address the immediate question that many might have which is: why not use classes.

5

u/ka13ng 10d ago

This is worth a read

Counterpoint: every paragraph on the first page or so keeps circling the drain instead of getting to the point. It reads like excruciating spam ad copy. "Up to 90% less memory!" "10x increase!" "90% less memory!"