Home / Function/ benchmarkRenderTime() — astro Function Reference

benchmarkRenderTime() — astro Function Reference

Architecture documentation for the benchmarkRenderTime() function in render.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6["benchmarkRenderTime()"]
  3c790668_be1c_58e1_f783_4e3a5b4e3a0d["render.js"]
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6 -->|defined in| 3c790668_be1c_58e1_f783_4e3a5b4e3a0d
  5859bb26_4e70_6d53_da16_27fa6a682cb2["run()"]
  5859bb26_4e70_6d53_da16_27fa6a682cb2 -->|calls| 0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6
  20b41f98_6e22_6f27_69c5_356f93aa2871["fetchRenderTime()"]
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6 -->|calls| 20b41f98_6e22_6f27_69c5_356f93aa2871
  726183f0_decf_6bca_ceb6_e7759e37fb91["calculateStat()"]
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6 -->|calls| 726183f0_decf_6bca_ceb6_e7759e37fb91
  style 0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmark/bench/render.js lines 63–82

export async function benchmarkRenderTime(portToListen = port) {
	/** @type {Record<string, number[]>} */
	const result = {};
	for (const fileName of renderPages) {
		// Render each file 100 times and push to an array
		for (let i = 0; i < 100; i++) {
			const pathname = '/' + fileName.slice(0, -path.extname(fileName).length);
			const renderTime = await fetchRenderTime(`http://localhost:${portToListen}${pathname}`);
			if (!result[pathname]) result[pathname] = [];
			result[pathname].push(renderTime);
		}
	}
	/** @type {Record<string, import('./_util.js').Stat>} */
	const processedResult = {};
	for (const [pathname, times] of Object.entries(result)) {
		// From the 100 results, calculate average, standard deviation, and max value
		processedResult[pathname] = calculateStat(times);
	}
	return processedResult;
}

Subdomains

Called By

Frequently Asked Questions

What does benchmarkRenderTime() do?
benchmarkRenderTime() is a function in the astro codebase, defined in benchmark/bench/render.js.
Where is benchmarkRenderTime() defined?
benchmarkRenderTime() is defined in benchmark/bench/render.js at line 63.
What does benchmarkRenderTime() call?
benchmarkRenderTime() calls 2 function(s): calculateStat, fetchRenderTime.
What calls benchmarkRenderTime()?
benchmarkRenderTime() is called by 1 function(s): run.

Analyze Your Own Codebase

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

Try Supermodel Free