resources/benchmark.js
function prepareAndRunBenchmarks(benchmarkPatterns, revisions) {
  // Find all benchmark tests to be run.
  let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js');
  if (benchmarkPatterns.length !== 0) {
    benchmarks = benchmarks.filter(benchmark =>
      benchmarkPatterns.some(pattern =>
        path.join('src', benchmark).includes(pattern)
      )
    );
  }

  if (benchmarks.length === 0) {
    console.warn(
      'No benchmarks matching: ' +
        `\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m`
    );
    return;
  }

  const environments = revisions.map(revision => ({
    revision,
    distPath: prepareRevision(revision),
  }));
  benchmarks.forEach(benchmark => runBenchmark(benchmark, environments));
}
function prepareAndRunBenchmarks(benchmarkPatterns, revisions) {
  // Find all benchmark tests to be run.
  let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js');
  if (benchmarkPatterns.length !== 0) {
    benchmarks = benchmarks.filter(benchmark =>
      benchmarkPatterns.some(pattern =>
        path.join('src', benchmark).includes(pattern)
      )
    );
  }

  if (benchmarks.length === 0) {
    console.warn(
      'No benchmarks matching: ' +
        `\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m`
    );
    return;
  }

  const environments = revisions.map(revision => ({
    revision,
    distPath: prepareRevision(revision),
  }));
  benchmarks.forEach(benchmark => runBenchmark(benchmark, environments));
}
function prepareAndRunBenchmarks ( benchmarkPatterns , revisions ) { // Find all benchmark tests to be run. let benchmarks = findFiles ( LOCAL_DIR ( 'src' ) , '*/__tests__/*-benchmark.js' ) ; if ( benchmarkPatterns . length !== 0 ) { benchmarks = benchmarks . filter ( benchmark => benchmarkPatterns . some ( pattern => path . join ( 'src' , benchmark ) . includes ( pattern ) ) ) ; } if ( benchmarks . length === 0 ) { console . warn ( 'No benchmarks matching: ' + ` \u001b ${ benchmarkPatterns . join ( '\u001b[0m or \u001b[1m' ) } \u001b ` ) ; return ; } const environments = revisions . map ( revision => ( { revision , distPath : prepareRevision ( revision ) , } ) ) ; benchmarks . forEach ( benchmark => runBenchmark ( benchmark , environments ) ) ; }
Prepare all revisions and run benchmarks matching a pattern against them.
Prepare all revisions and run benchmarks matching a pattern against them .