Skip to content
This repository
Browse code

Add a benchmark for `_.some` with `thisArg` and avoid corrupting the …

…aggregate score if a single benchmark errors. [ci skip]
  • Loading branch information...
commit c669aedf993d79a75ae6c6c00a2a7ab4eea37af5 1 parent c3225d9
John-David Dalton authored December 18, 2012

Showing 1 changed file with 16 additions and 1 deletion. Show diff stats Hide diff stats

  1. 17  perf/perf.js
17  perf/perf.js
@@ -78,7 +78,8 @@
78 78
    * @returns {Number} Returns the adjusted Hz.
79 79
    */
80 80
   function getHz(bench) {
81  
-    return 1 / (bench.stats.mean + bench.stats.moe);
  81
+    var result = 1 / (bench.stats.mean + bench.stats.moe);
  82
+    return isFinite(result) ? result : 0;
82 83
   }
83 84
 
84 85
   /**
@@ -1420,6 +1421,20 @@
1420 1421
   );
1421 1422
 
1422 1423
   suites.push(
  1424
+    Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
  1425
+      .add(buildName, '\
  1426
+        lodash.some(objects, function(value, index) {\
  1427
+          return this["key" + index] == 19;\
  1428
+        }, object)'
  1429
+      )
  1430
+      .add(otherName, '\
  1431
+        _.some(objects, function(value, index) {\
  1432
+          return this["key" + index] == 19;\
  1433
+        }, object)'
  1434
+      )
  1435
+  );
  1436
+
  1437
+  suites.push(
1423 1438
     Benchmark.Suite('`_.some` iterating an object')
1424 1439
       .add(buildName, '\
1425 1440
         lodash.some(object, function(num) {\

0 notes on commit c669aed

Please sign in to comment.
Something went wrong with that request. Please try again.