Comments (4)
Hi @benji6,
Sorry, but the first test that I want to add is about slice
method and I want to do some test with ramda. However I don't have so much experience with ramda
and if it is possible to apply slice
over a set iterable:
const set = new Set([1, 2, 3])
Array.from(iterum.slice(set, 0, 3)) // [1, 2, 3]
Array.from(imlazy.slice(0, 3, set)) // [1, 2, 3]
// and ramda?
I tried Array.from(ramda.slice(0, 3, set))
but the performance of ramda was really good and I discovered that the reason is that returns empty array [].
Maybe it is not applicable for ramda.
Thanks!
from iterum.
Hi!
Waiting for if it exists any way to slice a Set instance with ramda
, I created some performance tests for slice
.
For iterum 1.3.0 I have these results:
- slice
- array - small start index
- iterum x 102,306 ops/sec ±0.24% (90 runs sampled)
- imlazy x 115,186 ops/sec ±5.50% (71 runs sampled)
- ramda x 1,559,411 ops/sec ±0.27% (94 runs sampled)
- native x 1,908,464 ops/sec ±0.91% (89 runs sampled)
Fastest is native
- array - big start index
- iterum x 5,129 ops/sec ±0.71% (94 runs sampled)
- imlazy x 24,571 ops/sec ±2.85% (84 runs sampled)
- ramda x 1,510,341 ops/sec ±0.15% (89 runs sampled)
- native x 1,878,096 ops/sec ±0.20% (93 runs sampled)
Fastest is native
- array - create new sliced iterable (no traversing)
- iterum x 187,848 ops/sec ±1.60% (87 runs sampled)
- imlazy x 3,280 ops/sec ±0.88% (94 runs sampled)
- ramda x 1,013 ops/sec ±1.09% (70 runs sampled)
- native x 1,028 ops/sec ±0.82% (71 runs sampled)
Fastest is iterum
- no indexable iterable - small start index
- iterum x 85,268 ops/sec ±0.25% (89 runs sampled)
- imlazy x 101,178 ops/sec ±4.33% (76 runs sampled)
Fastest is imlazy
- no indexable iterable - big start index
- iterum x 3,723 ops/sec ±4.44% (92 runs sampled)
- imlazy x 9,381 ops/sec ±1.93% (88 runs sampled)
Fastest is imlazy
- no indexable iterable - create new sliced iterable (no traversing)
- iterum x 183,791 ops/sec ±1.26% (94 runs sampled)
- imlazy x 1,079 ops/sec ±0.13% (92 runs sampled)
Fastest is iterum
For iterum branch dev-2.0.0
- slice
- array - small start index
- iterum x 229,301 ops/sec ±1.16% (95 runs sampled)
- imlazy x 117,158 ops/sec ±5.18% (75 runs sampled)
- ramda x 1,568,007 ops/sec ±0.28% (96 runs sampled)
- native x 1,941,122 ops/sec ±0.21% (93 runs sampled)
Fastest is native
- array - big start index
- iterum x 221,244 ops/sec ±1.87% (90 runs sampled)
- imlazy x 25,342 ops/sec ±2.24% (87 runs sampled)
- ramda x 1,470,998 ops/sec ±0.28% (94 runs sampled)
- native x 1,899,217 ops/sec ±1.54% (92 runs sampled)
Fastest is native
- array - create new sliced iterable (no traversing)
- iterum x 274,096 ops/sec ±1.31% (88 runs sampled)
- imlazy x 3,291 ops/sec ±0.73% (95 runs sampled)
- ramda x 1,016 ops/sec ±1.22% (72 runs sampled)
- native x 1,011 ops/sec ±0.98% (77 runs sampled)
Fastest is iterum
- no indexable iterable - small start index
- iterum x 139,654 ops/sec ±1.45% (93 runs sampled)
- imlazy x 102,659 ops/sec ±4.39% (76 runs sampled)
Fastest is iterum
- no indexable iterable - big start index
- iterum x 8,083 ops/sec ±0.21% (90 runs sampled)
- imlazy x 9,258 ops/sec ±2.10% (89 runs sampled)
Fastest is imlazy
- no indexable iterable - create new sliced iterable (no traversing)
- iterum x 239,569 ops/sec ±1.44% (93 runs sampled)
- imlazy x 1,055 ops/sec ±0.47% (90 runs sampled)
Fastest is iterum
- two calls
- iterum x 7,968 ops/sec ±0.13% (95 runs sampled)
- imlazy x 4,644 ops/sec ±1.86% (90 runs sampled)
Fastest is iterum
from iterum.
Hey this is awesome!
So as far as I'm aware Ramda can't slice a Set... You could spread it into an array then pass it into Ramda's slice function first I suppose, but it's not quite the same thing
from iterum.
perf/benchmarks.md
has some benchmarks. I have to work hard improving the performance after publishing release 2.0.
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
- 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.