Ramda vs. Lodash

JavaScript performance comparison

Test case created by Yuri and last updated

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.14.0/ramda.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.8.0/lodash.js"></script>
      
<script>
Benchmark.prototype.setup = function() {
  arr = _.range(100000);
  function isOdd(num) {
    return num % 2 === 1;
  }
  function square(num) {
    return num * num;
  }

};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Lodash
var result = _.map(_.filter(arr, isOdd), square);
pending…
Ramda without reliance on currying
var result = R.map(square, R.filter(isOdd, arr));
pending…
Ramda with currying and composition
// Longer but more maintainable.
var result = R.pipe(
  R.filter(isOdd),
  R.map(square)
)(arr);
pending…
Native
var r = arr.filter(isOdd).map(square);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments