diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 96d6fe1c07..0cb66859f6 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -42,6 +42,7 @@ jobs: npm pack --ignore-scripts mv preact-*.tgz preact.tgz tar -xzf preact.tgz + rm preact.tgz - name: Upload build output uses: actions/upload-artifact@v2 with: diff --git a/benches/TODO.md b/benches/TODO.md index 8a3b356754..ec9430f5ec 100644 --- a/benches/TODO.md +++ b/benches/TODO.md @@ -8,4 +8,3 @@ * Add bench mimicking speedometer * Add a realworld-like bench? * Add a specialized bench that hits certain code paths other's miss (e.g. style attribute handling?) -* Add analyze script and PR to add --trace to tachometer diff --git a/benches/scripts/config.js b/benches/scripts/config.js index 7461512823..4883425528 100644 --- a/benches/scripts/config.js +++ b/benches/scripts/config.js @@ -228,10 +228,6 @@ export async function generateConfig(benchPath, options) { continue; } - if (options.prepare !== false) { - await prepare(framework.label); - } - benchmarks.push({ ...baseBenchConfig, packageVersions: framework, @@ -240,6 +236,10 @@ export async function generateConfig(benchPath, options) { }); } + if (options.prepare !== false) { + await prepare(benchmarks.map(b => b.packageVersions.label)); + } + /** @type {ConfigFile} */ const config = { $schema: TACH_SCHEMA, diff --git a/benches/scripts/prepare.js b/benches/scripts/prepare.js index ee41378c2e..da1b7f3af8 100644 --- a/benches/scripts/prepare.js +++ b/benches/scripts/prepare.js @@ -7,16 +7,22 @@ import { repoRoot } from './utils.js'; const npmCmd = process.platform == 'win32' ? 'npm.cmd' : 'npm'; /** - * @param {TachometerOptions["framework"]} framework + * @param {string[]} frameworks */ -export async function prepare(framework) { +export async function prepare(frameworks) { const proxyRoot = repoRoot('benches/proxy-packages'); - for (let dirname of await readdir(proxyRoot)) { - if (!framework.includes(dirname.replace(/-proxy/g, ''))) { + const proxyDirs = (await readdir(proxyRoot)).map(dirname => + dirname.replace(/-proxy$/, '') + ); + + for (let framework of frameworks) { + const dirname = proxyDirs.find(dir => dir == framework); + if (dirname == null) { continue; } - const proxyDir = (...args) => path.join(proxyRoot, dirname, ...args); + const proxyDir = (...args) => + path.join(proxyRoot, dirname + '-proxy', ...args); // It appears from ad-hoc testing (npm v6.14.9 on Windows), npm will cache // any locally referenced tarball files (e.g. "file:../../../preact.tgz") in