Home / Function/ benchmark() — astro Function Reference

benchmark() — astro Function Reference

Architecture documentation for the benchmark() function in content-benchmark.mjs from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  6d277f3d_88f9_05d3_9a12_e441d72b9900["benchmark()"]
  b92732a1_433f_7d78_4b70_e38568589f59["content-benchmark.mjs"]
  6d277f3d_88f9_05d3_9a12_e441d72b9900 -->|defined in| b92732a1_433f_7d78_4b70_e38568589f59
  2d88dc27_faa3_1ba8_2029_e9a5f69084d4["generatePosts()"]
  6d277f3d_88f9_05d3_9a12_e441d72b9900 -->|calls| 2d88dc27_faa3_1ba8_2029_e9a5f69084d4
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture()"]
  6d277f3d_88f9_05d3_9a12_e441d72b9900 -->|calls| dd4f09ce_3fd7_8295_f616_8876cda4555c
  824cd512_3555_9162_3db1_45e22e1def28["getTimeStat()"]
  6d277f3d_88f9_05d3_9a12_e441d72b9900 -->|calls| 824cd512_3555_9162_3db1_45e22e1def28
  style 6d277f3d_88f9_05d3_9a12_e441d72b9900 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/performance/content-benchmark.mjs lines 17–38

async function benchmark({ fixtures, templates, numPosts }) {
	for (const fixture of fixtures) {
		const root = new URL(`./fixtures/${fixture}/`, import.meta.url);
		await generatePosts({
			postsDir: fileURLToPath(new URL('./src/content/generated/', root)),
			numPosts,
			ext: extByFixture[fixture],
			template: templates[fixture],
		});
		console.info(`[${fixture}] Generated posts`);

		const { build } = await loadFixture({
			root,
		});
		const now = performance.now();
		console.info(`[${fixture}] Building...`);
		await build();
		console.info(
			colors.cyan(`[${fixture}] Built in ${colors.bold(getTimeStat(now, performance.now()))}.`),
		);
	}
}

Domain

Subdomains

Frequently Asked Questions

What does benchmark() do?
benchmark() is a function in the astro codebase, defined in packages/astro/performance/content-benchmark.mjs.
Where is benchmark() defined?
benchmark() is defined in packages/astro/performance/content-benchmark.mjs at line 17.
What does benchmark() call?
benchmark() calls 3 function(s): generatePosts, getTimeStat, loadFixture.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free