Skip to content

Commit

Permalink
chore(perf-benchmarks): fix displayed benchmark name (#4922)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Nov 25, 2024
1 parent e7fb97c commit 9dfaf0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@lwc/perf-benchmarks/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,17 @@ async function processBenchmarkFile(benchmarkFile, directoryHash) {
const benchmarkFileBasename = path.basename(benchmarkFile);
const htmlFilename = path.join(targetDir, benchmarkFileBasename.replace('.js', '.html'));

// Generate a pretty name for the benchmark to display in Tachometer results
const splitFileName = benchmarkFile.split(path.sep);
const engineType = splitFileName[splitFileName.indexOf('__benchmarks__') + 1];
const benchmarkName = `${engineType}-${benchmarkFileBasename.split('.')[0]}`;

async function writeHtmlFile() {
const html = createHtml(benchmarkFile);
await writeFile(htmlFilename, html, 'utf8');
}

async function writeTachometerJsonFile() {
const engineType = benchmarkFile.includes('/engine-server/') ? 'server' : 'dom';
const benchmarkName = `${engineType}-${benchmarkFileBasename.split('.')[0]}`;
const cpuThrottlingRate =
typeof BENCHMARK_CPU_THROTTLING_RATE === 'number'
? BENCHMARK_CPU_THROTTLING_RATE
Expand Down

0 comments on commit 9dfaf0f

Please sign in to comment.