summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/bench/_util.js7
-rw-r--r--benchmark/make-project/server-stress-default.js13
2 files changed, 17 insertions, 3 deletions
diff --git a/benchmark/bench/_util.js b/benchmark/bench/_util.js
index c9108695c..23c472604 100644
--- a/benchmark/bench/_util.js
+++ b/benchmark/bench/_util.js
@@ -1,6 +1,9 @@
-import { createRequire } from 'module';
+import { createRequire } from 'node:module';
+import path from 'node:path';
-export const astroBin = createRequire(import.meta.url).resolve('astro');
+const astroPkgPath = createRequire(import.meta.url).resolve('astro/package.json');
+
+export const astroBin = path.resolve(astroPkgPath, '../astro.js');
/** @typedef {{ avg: number, stdev: number, max: number }} Stat */
diff --git a/benchmark/make-project/server-stress-default.js b/benchmark/make-project/server-stress-default.js
index 20094daa6..cbeeeda3b 100644
--- a/benchmark/make-project/server-stress-default.js
+++ b/benchmark/make-project/server-stress-default.js
@@ -7,11 +7,13 @@ import { loremIpsum } from './_util.js';
export async function run(projectDir) {
await fs.rm(projectDir, { recursive: true, force: true });
await fs.mkdir(new URL('./src/pages', projectDir), { recursive: true });
+ await fs.mkdir(new URL('./src/components', projectDir), { recursive: true });
await fs.writeFile(
new URL('./src/pages/index.astro', projectDir),
`\
---
+import Paragraph from '../components/Paragraph.astro'
const content = "${loremIpsum}"
---
@@ -25,7 +27,10 @@ const content = "${loremIpsum}"
<body>
<h1>Astro</h1>
<div>
- ${Array.from({ length: 60 }).map(() => '<p>{content}</p>')}
+ ${Array.from({ length: 100 }).map(() => '<p>{content}</p>').join('\n')}
+ </div>
+ <div>
+ ${Array.from({ length: 50 }).map((_, i) => '<Paragraph num={' + i + '} str={content} />').join('\n')}
</div>
</body>
</html>`,
@@ -33,6 +38,12 @@ const content = "${loremIpsum}"
);
await fs.writeFile(
+ new URL('./src/components/Paragraph.astro', projectDir),
+ `<div>{Astro.props.num} {Astro.props.str}</div>`,
+ 'utf-8'
+ );
+
+ await fs.writeFile(
new URL('./astro.config.js', projectDir),
`\
import { defineConfig } from 'astro/config';