Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const [
controlSettings,
experimentSettings,
] = this.generateControlExperimentServerConfig();
// 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
controlSettings,
experimentSettings,
] = this.generateControlExperimentServerConfig();
// 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(
};
const TRACER_BENCH_RESULTS_PATH = path.resolve(
__dirname,
`../../../packages/unpublished-relationship-performance-test-app/tracerbench-results`
);
const control = new InitialRenderBenchmark({
name: 'control',
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)
);
'--disable-gpu',
'--hide-scrollbars',
'--mute-audio',
'--v8-cache-options=none',
'--disable-cache',
'--disable-v8-idle-tasks',
'--crash-dumps-dir=./tmp',
],
};
const TRACER_BENCH_RESULTS_PATH = path.resolve(
__dirname,
`../../../packages/unpublished-relationship-performance-test-app/tracerbench-results`
);
const control = new InitialRenderBenchmark({
name: 'control',
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...');