Thanks for sharing links. While linked lists definitely have their usage, we must keep in mind that access by index costs
O(n)
for them. Yet, because each item produces additional object(s), memory fragmentation increases.
Ordered map is indeed a problem in JS, and devs should either implement it, or use some lib, or just order and array of [key, value] tuples. Which is best? It depends 🙂
Thanks for sharing links. While linked lists definitely have their usage, we must keep in mind that access by index costs O(n) for them. Yet, because each item produces additional object(s), memory fragmentation increases.
Ordered map is indeed a problem in JS, and devs should either implement it, or use some lib, or just order and array of
[key, value]
tuples. Which is best? It depends 🙂You're right. However, I think index based access is overrated, because you don't need it that often.
Btw. I don't think immer.js is a good solution, because it doesn't seem to compose.