Update bench options in stats-config (#41432)
x-ref: https://github.com/vercel/next.js/actions/runs/3252514635/jobs/5338830017 x-ref: https://github.com/vercel/next.js/actions/runs/3250842765/jobs/5335182082
This commit is contained in:
parent
974e8b61c7
commit
c66b8f3926
4 changed files with 16 additions and 117 deletions
|
@ -16,7 +16,10 @@ function loadStatsConfig() {
|
|||
'stats-config.js'
|
||||
))
|
||||
break
|
||||
} catch (_) {
|
||||
} catch (err) {
|
||||
if (err.code !== 'MODULE_NOT_FOUND') {
|
||||
console.error('Failed to load stats-config at', configPath, err)
|
||||
}
|
||||
/* */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,55 +169,6 @@ async function runConfigs(
|
|||
)
|
||||
)
|
||||
curStats.General.buildDurationCached = Date.now() - secondBuildStart
|
||||
|
||||
if (statsConfig.appDevCommand) {
|
||||
const port = await getPort()
|
||||
const startTime = Date.now()
|
||||
const child = exec.spawn(statsConfig.appDevCommand, {
|
||||
cwd: statsAppDir,
|
||||
env: {
|
||||
PORT: port,
|
||||
},
|
||||
stdio: 'pipe',
|
||||
})
|
||||
|
||||
let serverReadyResolve
|
||||
let serverReadyResolved = false
|
||||
const serverReadyPromise = new Promise((resolve) => {
|
||||
serverReadyResolve = resolve
|
||||
})
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
if (
|
||||
data.toString().includes('started server') &&
|
||||
!serverReadyResolved
|
||||
) {
|
||||
serverReadyResolved = true
|
||||
serverReadyResolve()
|
||||
}
|
||||
process.stdout.write(data)
|
||||
})
|
||||
child.stderr.on('data', (data) => process.stderr.write(data))
|
||||
|
||||
child.on('exit', (code) => {
|
||||
if (!serverReadyResolved) {
|
||||
serverReadyResolve()
|
||||
serverReadyResolved = true
|
||||
}
|
||||
exitCode = code
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
if (!serverReadyResolved) {
|
||||
child.kill()
|
||||
}
|
||||
}, 3 * 1000)
|
||||
|
||||
await serverReadyPromise
|
||||
child.kill()
|
||||
|
||||
curStats['General']['nextDevReadyDuration'] = Date.now() - startTime
|
||||
}
|
||||
}
|
||||
|
||||
logger(`Finished running: ${config.title}`)
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
// this page is conditionally added when not testing
|
||||
// in webpack 4 mode since it's not supported for webpack 4
|
||||
const imagePageData = fs.readFileSync(
|
||||
path.join(__dirname, './image.js'),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
const clientGlobs = [
|
||||
{
|
||||
name: 'Client Bundles (main, webpack)',
|
||||
|
@ -84,17 +75,13 @@ module.exports = {
|
|||
title: 'Default Build',
|
||||
diff: 'onOutputChange',
|
||||
diffConfigFiles: [
|
||||
{
|
||||
path: 'pages/image.js',
|
||||
content: imagePageData,
|
||||
},
|
||||
{
|
||||
path: 'next.config.js',
|
||||
content: `
|
||||
module.exports = {
|
||||
experimental: {
|
||||
appDir: true,
|
||||
// remove after next stable relase (current v12.3.1)
|
||||
// remove after next stable release (current v12.3.1)
|
||||
serverComponents: true,
|
||||
},
|
||||
generateBuildId: () => 'BUILD_ID',
|
||||
|
@ -110,10 +97,6 @@ module.exports = {
|
|||
// renames to apply to make file names deterministic
|
||||
renames,
|
||||
configFiles: [
|
||||
{
|
||||
path: 'pages/image.js',
|
||||
content: imagePageData,
|
||||
},
|
||||
{
|
||||
path: 'next.config.js',
|
||||
content: `
|
||||
|
@ -135,51 +118,22 @@ module.exports = {
|
|||
'http://localhost:$PORT/link',
|
||||
'http://localhost:$PORT/withRouter',
|
||||
],
|
||||
pagesToBench: [
|
||||
'http://localhost:$PORT/',
|
||||
'http://localhost:$PORT/error-in-render',
|
||||
],
|
||||
benchOptions: {
|
||||
reqTimeout: 60,
|
||||
concurrency: 50,
|
||||
numRequests: 2500,
|
||||
},
|
||||
// TODO: investigate replacing "ab" for this
|
||||
// pagesToBench: [
|
||||
// 'http://localhost:$PORT/',
|
||||
// 'http://localhost:$PORT/error-in-render',
|
||||
// ],
|
||||
// benchOptions: {
|
||||
// reqTimeout: 60,
|
||||
// concurrency: 50,
|
||||
// numRequests: 2500,
|
||||
// },
|
||||
},
|
||||
{
|
||||
title: 'Default Build with SWC',
|
||||
diff: 'onOutputChange',
|
||||
diffConfigFiles: [
|
||||
{
|
||||
path: 'pages/image.js',
|
||||
content: imagePageData,
|
||||
},
|
||||
{
|
||||
path: 'next.config.js',
|
||||
content: `
|
||||
module.exports = {
|
||||
experimental: {
|
||||
appDir: true,
|
||||
// remove after next stable relase (current v12.3.1)
|
||||
serverComponents: true
|
||||
},
|
||||
generateBuildId: () => 'BUILD_ID',
|
||||
swcMinify: true,
|
||||
webpack(config) {
|
||||
config.optimization.minimize = false
|
||||
config.optimization.minimizer = undefined
|
||||
return config
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
],
|
||||
title: 'Default Build with SWC minify',
|
||||
// renames to apply to make file names deterministic
|
||||
renames,
|
||||
configFiles: [
|
||||
{
|
||||
path: 'pages/image.js',
|
||||
content: imagePageData,
|
||||
},
|
||||
{
|
||||
path: 'next.config.js',
|
||||
content: `
|
||||
|
@ -202,15 +156,6 @@ module.exports = {
|
|||
'http://localhost:$PORT/link',
|
||||
'http://localhost:$PORT/withRouter',
|
||||
],
|
||||
pagesToBench: [
|
||||
'http://localhost:$PORT/',
|
||||
'http://localhost:$PORT/error-in-render',
|
||||
],
|
||||
benchOptions: {
|
||||
reqTimeout: 60,
|
||||
concurrency: 50,
|
||||
numRequests: 2500,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue