
Show HN: Rambda – Faster alternative to Ramda in just 10kB - self_refactor
https://github.com/selfrefactor/rambda
======
fiatjaf
Why is it so faster?

~~~
self_refactor
Partial paste from [https://survivejs.com/blog/rambda-interview/#how-does-
rambda...](https://survivejs.com/blog/rambda-interview/#how-does-rambda-
differ-from-the-other-solutions-) \---

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 < len) {
    
        if (fn(list[idx])) {
    
          return list[idx];
    
        }
    
        idx += 1;
    
      }
    

}));

Rambda:

function find(fn, arr){

    
    
      if (arr === undefined) {
    
        return holder => find(fn, holder)
    
      }
    
      return arr.find(fn)
    }

