code: function benchmark(name, fn) {
  
          // Prepare innerloop function
          var innerLoop = eval(
              "(function(f) {" +
              "   return function innerLoop4" + fn.name + "(n) {" +
              "       for (var i = 0; i < n; i++) f()" +
              "   };" +
              "})")(fn);
  
          // Pre test
          var timeExcess = testTime * 1.1;
          var init = Date.now();
          innerLoop(preTestIterations, fn);
          var elapsed = Date.now() - init + 1;
          var iterations = 0 | Math.min(maxIterations, timeExcess / elapsed * 1000);
  
          // Test
          var checks = 0;
          var totalIterations = 0;
          init = Date.now();
          do {
              innerLoop(iterations);
              totalIterations += iterations;
              checks++;
              elapsed = Date.now() - init;
              if (elapsed >= testTime) break;
              iterations = 0 | Math.min(maxIterations, (timeExcess - elapsed) / (elapsed + 1) * totalIterations);
          } while (elapsed < testTime);
  
          // Stats
          var secs = elapsed / 1000;
          var perSecondIterations = 0 | totalIterations / secs;
          if (verbose) {
              console.log('Function "%s" running for %d seconds: %s checks, %s total iterations, %s iterations per second',
                  name,
                  Math.round(secs * 100) / 100,
                  checks,
                  totalIterations.toLocaleString(),
                  perSecondIterations.toLocaleString()
              );
          }
  
          // Global stats
          benchmark.results.push({
              name: name,
              elapsed: elapsed,
              checks: checks,
              totalIterations: totalIterations,
              perSecondIterations: perSecondIterations,
              isOptimized: checkOptimization ? isOptimized(fn) : null
          });
          benchmark.results.sort(function (a, b) {
              return b.perSecondIterations - a.perSecondIterations;}
          );
          var max = benchmark.results[0].perSecondIterations;
          benchmark.results.forEach(function (a) {
              return a.diff = Math.round((max - a.perSecondIterations) / max * 10000) / 100 + "%";
          });
  
      }
docs: Benchmark function