Comments (4)
I created a new package iterarray with a tiny API (slice
& nth
) to achieve better performance with sliced iterables, caching values and taking advantage of performance when iterables that are passed are indexables.
I going to use iterarray
as a dependency of iterum
to bring better performance and simplify some methods.
from iterum.
If possible are you able to collect some benchmarks on the new approach using iterarray
?
I've been thinking about performance a lot in imlazy and am pretty stoked that it seems to be running faster than native array methods now in node 8! I decided against a caching approach though because in theory a user should be able to pull from an infinite iterable without ever having to worry about memory running out... What if they want to take some values from an infinite iterable every time an event occurs and the code is running for a long time on a tiny node machine? Will it fall over eventually? It's something of a niche use-case but naive caching does introduce that risk... Would be good to see what perf gains you make with it though
from iterum.
Hi @benji6!
It sounds good. I will collect some benchmarks on the last 1.x version and 2.0 version to contrast that.
My idea of iterarray
package is:
- to have
nth(n)
with O(1) amortized cost (the first call with O(n) cost, the next calls withO(1)
) - to keep
.slice
withO(1)
cost - to traverse
slice(m, n)
withO(m - n)
amortized cost (the first time withO(n)
and the next times withO(n - m)
).
But certainly, achieving this can produce memory issues. I should think on this.
Thanks so much!
from iterum.
No worries, really interesting to see what you're getting up to here!
from iterum.
Related Issues (20)
- Implement lazy cartesian product HOT 3
- implement `power` method
- implement `combinations` method HOT 1
- Removing optional arguments in methods. HOT 4
- removing forEach method
- removing `fromIndex` arguments. HOT 2
- Implement `has` & `nth` methods
- Add benchmarks HOT 4
- permutations method must work with infinite iterables
- remove default behaviour of Iterum functions if first parameter is not an iterable.
- adapt functions to functional style (iterable last) HOT 3
- currying functions
- add powerset method and function
- add variations (k-permutations) method and function
- implement zipLongest & transposeLongest
- implement `tap`
- implement chunk
- implement toString
- Implement cycle
- adapt indexOf to use sameValueZero specification for equality
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iterum.