Show HN: Rambda – Faster alternative to Ramda in just 10kB
1–3 of 3 posts
Re: Show HN: Rambda – Faster alternative to Ramda in just 10kB
#2Why is it so faster?
Re: Show HN: Rambda – Faster alternative to Ramda in just 10kB
#3Why is it so faster?
Partial paste from https://survivejs.com/blog/rambda-interview/#how-does-rambda...
---
The main reason for the better performance is that Rambda methods only need to take care for currying and execution, while Ramda methods cover more use cases. Therefore Ramda have more elaborate boilerplate around the actual execution, which results in slower performance.
We can see an illustration of that in the code of `find` method of Ramda and Rambda.
Ramda:
var _curry2 = require('./internal/_curry2');
var _dispatchable = require('./internal/_dispatchable');
var _xfind = require('./internal/_xfind');
module.exports = _curry2(_dispatchable(['find'], _xfind, function find(fn, list) {
var idx = 0;
var len = list.length;
while (idx
}));Rambda:
function find(fn, arr){
if (arr === undefined) {
return holder => find(fn, holder)
}
return arr.find(fn)
}