How to use the @tracerbench/core.Runner function in @tracerbench/core

To help you get started, we’ve selected a few @tracerbench/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TracerBench / tracerbench / packages / cli / src / commands / compare / index.ts View on Github external
// this should be directly above the instantiation of the InitialRenderBenchmarks
    if (this.parsedConfig.debug) {
      Object.entries(this.parsedConfig).forEach(([key, value]) => {
        if (value) {
          this.log(`${key}: ${JSON.stringify(value)}`);
        }
      });
    }

    const benchmarks = {
      control: new InitialRenderBenchmark(controlSettings),
      experiment: new InitialRenderBenchmark(experimentSettings),
    };

    const runner = new Runner([benchmarks.control, benchmarks.experiment]);
    await runner
      .run(this.compareFlags.fidelity, this.log)
      .then(async (results: any) => {
        if (!results[0].samples[0]) {
          this.error(
            `Could not sample from provided urls\nCONTROL: ${this.parsedConfig.controlURL}\nEXPERIMENT: ${this.parsedConfig.experimentURL}.`
          );
        }
        const resultJSONPath = `${this.parsedConfig.tbResultsFolder}/compare.json`;

        fs.writeFileSync(resultJSONPath, JSON.stringify(results, null, 2));
        // tslint:disable-next-line: max-line-length
        const message = `${chalkScheme.blackBgGreen(
          `    ${chalkScheme.white('SUCCESS!')}    `
        )} ${this.parsedConfig.fidelity} test samples were taken.`;
        this.log(`\n${message}`);
github emberjs / data / bin / relationship-performance-tracking / src / tracerbench.js View on Github external
url: 'http://localhost:4200/?tracerbench=true',
  markers,
  browser,
  saveTraces: () => path.resolve(TRACER_BENCH_RESULTS_PATH, 'control-trace.json'),
});

const experiment = new InitialRenderBenchmark({
  name: 'experiment',
  url: 'http://localhost:4201/?tracerbench=true',
  markers,
  browser,
  saveTraces: () => path.resolve(TRACER_BENCH_RESULTS_PATH, 'experiment-trace.json'),
});

console.log('Computing results...');
const runner = new Runner([control, experiment]);
runner
  .run(samplesCount)
  .then(results => {
    return fs.writeFileSync(
      path.resolve(TRACER_BENCH_RESULTS_PATH, 'trace-results.json'),
      JSON.stringify(results, null, 2)
    );
  })
  .catch(err => {
    console.error(err);
    process.exit(1);
  });