Ramda contains prop

JavaScript performance comparison

Test case created by Santeri Hiltunen

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.23.0/ramda.min.js"></script>

      
<script>
Benchmark.prototype.setup = function() {
  var email = "lobal@example.com";
  var list = [
   {email: "jonne@example.com", a:1, b: false},
   {email: "jonne@example.com", a:1, b: false},
   {email: "jonne@example.com", a:1, b: false},
   {email: "jonne@example.com", a:1, b: false},
   {email: "jonne@example.com", a:1, b: false},
   {email: "jonne@example.com", a:1, b: false},
   {email: "lolbal@example.com", a:1, b: false}
  ];

};
</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
Native
list.some(function (e) { return e.email === email });
pending…
Any propEq
R.any(R.propEq("email", email), list);
pending…
Contains pluck
R.contains(email, R.pluck("email", list));
pending…
Native with propEq
list.some(R.propEq("email", email));
pending…

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

0 Comments