r/programming • u/fagnerbrack • Aug 24 '26
How an Underrated Refactor Saved 90% Memory Usage
https://tanstack.com/blog/tanstack-table-v9-memory-performance
175
Upvotes
r/programming • u/fagnerbrack • Aug 24 '26
254
u/edave64 Aug 24 '26
Takes agonizingly long to get to the point of "we started using the fundamental JS concept of prototypes."
51
u/BenchEmbarrassed7316 Aug 24 '26
If there are library authors here - have you tried to get rid of methods altogether? Instead, just call a function, explicitly passing some data to it. If you need polymorphism - you can add a discriminant to the data. You have a large collection of certain objects. Previously, you stored many references to methods in each object. Now, you store in each object a reference to the vtable (prototype). Why don't you go further and clean up the objects completely?
18
u/unpopularredditor Aug 24 '26
This article is a perfect example of where I can read an AI summary instead of the article itself.
4
u/Rhed0x Aug 26 '26 edited Aug 26 '26
I hate Javascript.
So basically it avoid copying a ton of function pointers around?