benchmarks/browser/benchmark.js
function compare(other) {
      var bench = this;

      // Exit early if comparing the same benchmark.
      if (bench == other) {
        return 0;
      }
      var critical,
          zStat,
          sample1 = bench.stats.sample,
          sample2 = other.stats.sample,
          size1 = sample1.length,
          size2 = sample2.length,
          maxSize = max(size1, size2),
          minSize = min(size1, size2),
          u1 = getU(sample1, sample2),
          u2 = getU(sample2, sample1),
          u = min(u1, u2);

      function getScore(xA, sampleB) {
        return _.reduce(sampleB, function(total, xB) {
          return total + (xB > xA ? 0 : xB < xA ? 1 : 0.5);
        }, 0);
      }

      function getU(sampleA, sampleB) {
        return _.reduce(sampleA, function(total, xA) {
          return total + getScore(xA, sampleB);
        }, 0);
      }

      function getZ(u) {
        return (u - ((size1 * size2) / 2)) / sqrt((size1 * size2 * (size1 + size2 + 1)) / 12);
      }
      // Reject the null hypothesis the two samples come from the
      // same population (i.e. have the same median) if...
      if (size1 + size2 > 30) {
        // ...the z-stat is greater than 1.96 or less than -1.96
        // http://www.statisticslectures.com/topics/mannwhitneyu/
        zStat = getZ(u);
        return abs(zStat) > 1.96 ? (u == u1 ? 1 : -1) : 0;
      }
      // ...the U value is less than or equal the critical U value.
      critical = maxSize < 5 || minSize < 3 ? 0 : uTable[maxSize][minSize - 3];
      return u <= critical ? (u == u1 ? 1 : -1) : 0;
    }
function compare(other) {
      var bench = this;

      // Exit early if comparing the same benchmark.
      if (bench == other) {
        return 0;
      }
      var critical,
          zStat,
          sample1 = bench.stats.sample,
          sample2 = other.stats.sample,
          size1 = sample1.length,
          size2 = sample2.length,
          maxSize = max(size1, size2),
          minSize = min(size1, size2),
          u1 = getU(sample1, sample2),
          u2 = getU(sample2, sample1),
          u = min(u1, u2);

      function getScore(xA, sampleB) {
        return _.reduce(sampleB, function(total, xB) {
          return total + (xB > xA ? 0 : xB < xA ? 1 : 0.5);
        }, 0);
      }

      function getU(sampleA, sampleB) {
        return _.reduce(sampleA, function(total, xA) {
          return total + getScore(xA, sampleB);
        }, 0);
      }

      function getZ(u) {
        return (u - ((size1 * size2) / 2)) / sqrt((size1 * size2 * (size1 + size2 + 1)) / 12);
      }
      // Reject the null hypothesis the two samples come from the
      // same population (i.e. have the same median) if...
      if (size1 + size2 > 30) {
        // ...the z-stat is greater than 1.96 or less than -1.96
        // http://www.statisticslectures.com/topics/mannwhitneyu/
        zStat = getZ(u);
        return abs(zStat) > 1.96 ? (u == u1 ? 1 : -1) : 0;
      }
      // ...the U value is less than or equal the critical U value.
      critical = maxSize < 5 || minSize < 3 ? 0 : uTable[maxSize][minSize - 3];
      return u <= critical ? (u == u1 ? 1 : -1) : 0;
    }
function compare ( other ) { var bench = this ; // Exit early if comparing the same benchmark. if ( bench == other ) { return 0 ; } var critical , zStat , sample1 = bench . stats . sample , sample2 = other . stats . sample , size1 = sample1 . length , size2 = sample2 . length , maxSize = max ( size1 , size2 ) , minSize = min ( size1 , size2 ) , u1 = getU ( sample1 , sample2 ) , u2 = getU ( sample2 , sample1 ) , u = min ( u1 , u2 ) ; function getScore ( xA , sampleB ) { return _ . reduce ( sampleB , function ( total , xB ) { return total + ( xB > xA ? 0 : xB < xA ? 1 : 0.5 ) ; } , 0 ) ; } function getU ( sampleA , sampleB ) { return _ . reduce ( sampleA , function ( total , xA ) { return total + getScore ( xA , sampleB ) ; } , 0 ) ; } function getZ ( u ) { return ( u - ( ( size1 * size2 ) / 2 ) ) / sqrt ( ( size1 * size2 * ( size1 + size2 + 1 ) ) / 12 ) ; } // Reject the null hypothesis the two samples come from the // same population (i.e. have the same median) if... if ( size1 + size2 > 30 ) { // ...the z-stat is greater than 1.96 or less than -1.96 // http://www.statisticslectures.com/topics/mannwhitneyu/ zStat = getZ ( u ) ; return abs ( zStat ) > 1.96 ? ( u == u1 ? 1 : - 1 ) : 0 ; } // ...the U value is less than or equal the critical U value. critical = maxSize < 5 || minSize < 3 ? 0 : uTable [ maxSize ] [ minSize - 3 ] ; return u <= critical ? ( u == u1 ? 1 : - 1 ) : 0 ; }
Determines if a benchmark is faster than another.

@memberOf Benchmark
@param {Object} other The benchmark to compare.
@returns {number} Returns `-1` if slower, `1` if faster, and `0` if indeterminate.
Determines if a benchmark is faster than another .