funkia/list compatibility?
See original GitHub issue- Could ts-belt be used with https://github.com/funkia/list ?
List is a purely functional alternative to arrays. … List is immutable. … Since List doesn’t allow mutations it can be heavily optimized for pure operations.
-
List’s benchmarks are quite impressive. Would like to see a comparison with ts-belt for the operations they share, like
map
. Or compare ts-belt with Ramda + List, since List was designed to seamlessly integrate with Ramda. -
Maybe ts-belt could even benefit from integrating List?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
funkia/list: An immutable list with unmatched ... - GitHub
Both variants are 100% TypeScript compatible. Does one thing well. Instead of offering a wealth of data structures List has a tight focus...
Read more >@funkia/list - npm
Written in TypeScript and comes with accurate types that cover the entire library. Fantasy Land support. Ships with tree-shaking compatible ES ...
Read more >list - UNPKG
12, <a href="https://codecov.io/gh/funkia/list"><img ... Both variants are 100% TypeScript compatible. ... 55, * **Fully compatible with tree-shaking**.
Read more >Compatibility (mechanics) - Wikipedia
Compatibility conditions are mathematical conditions that determine whether a particular deformation will leave a body in a compatible state. In the context of ......
Read more >Arden on Twitter: "This looks extremely useful https://t.co ...
... support - TypeScript types - Ramda integration - Fantasy Land compatibility. Feedback is much appreciated See it here: https://github.com/funkia/list.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @redbar0n. Thanks for the question. From what I can see above the benchmarks only test
map
,filter
, andreduce
. These operations are not the most interesting to benchmark as they all are going to haveO(n)
complexity and for such operations arrays and cons-lists/singly-linked lists are going to be the fastest due to lower constants.Compared to arrays you get performance benefits with operations where it’s possible to achieve an improvement in complexity due to the efficient immutable data structure that List implements. For instance
prepend
,append
,concat
,splitAt
,insertAt
,take
, etc. are going to be much faster for large sizes than arrays.You can see this, for instance, in the
insert
benchmark. Ramda is slightly faster for small arrays but quickly becomes much slower than List. This is because inserting an element in an array requires copying the entire array. So inserting one element in a 1000 element long array causes all the 1000 elements to be copied into a new array. List on the other hand uses structural sharing to avoid most copying and will have to copy onlylog_32(1000) ≈ 2
elements.thanks for the detailed explanation @paldepind 🚀 to sum up:
ts-belt
is compatible withfunkia/list
funkia/list
if you want to achieve high performance when dealing with really large lists, for instance: adding at the head, getting the tail, splitting will be faster, but if you need to randomly access an itemfunkia/list
will be slower