Home / File/ render.bench.js — astro Source File

render.bench.js — astro Source File

Architecture documentation for render.bench.js, a javascript file in the astro codebase. 3 imports, 0 dependents.

File javascript 3 imports

Entity Profile

Dependency Diagram

graph LR
  735e177a_d226_e766_be75_ab8643d9f1b7["render.bench.js"]
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  735e177a_d226_e766_be75_ab8643d9f1b7 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  735e177a_d226_e766_be75_ab8643d9f1b7 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  3e3298c2_86dd_c820_c444_b15ecaad6b48["vitest"]
  735e177a_d226_e766_be75_ab8643d9f1b7 --> 3e3298c2_86dd_c820_c444_b15ecaad6b48
  style 735e177a_d226_e766_be75_ab8643d9f1b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { existsSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { beforeAll, bench, describe } from 'vitest';

const renderRoot = new URL('../projects/render-bench/', import.meta.url);

let streamingApp;
let nonStreamingApp;
beforeAll(async () => {
	const entry = new URL('./dist/server/entry.mjs', renderRoot);

	if (!existsSync(fileURLToPath(entry))) {
		throw new Error(
			'render-bench project not built. Please run `pnpm run build:bench` before running the benchmarks.',
		);
	}

	const { manifest, createApp } = await import(entry);
	streamingApp = createApp(manifest, true);
	nonStreamingApp = createApp(manifest, false);
}, 900000);

describe('Bench rendering', () => {
	bench('Rendering: streaming [true], .astro file', async () => {
		const request = new Request(new URL('http://exmpale.com/astro'));
		await streamingApp.render(request);
	});
	bench('Rendering: streaming [true], .md file', async () => {
		const request = new Request(new URL('http://exmpale.com/md'));
		await streamingApp.render(request);
	});
	bench('Rendering: streaming [true], .mdx file', async () => {
		const request = new Request(new URL('http://exmpale.com/mdx'));
		await streamingApp.render(request);
	});

	bench('Rendering: streaming [false], .astro file', async () => {
		const request = new Request(new URL('http://exmpale.com/astro'));
		await nonStreamingApp.render(request);
	});
	bench('Rendering: streaming [false], .md file', async () => {
		const request = new Request(new URL('http://exmpale.com/md'));
		await nonStreamingApp.render(request);
	});
	bench('Rendering: streaming [false], .mdx file', async () => {
		const request = new Request(new URL('http://exmpale.com/mdx'));
		await nonStreamingApp.render(request);
	});
});

Dependencies

  • node:fs
  • node:url
  • vitest

Frequently Asked Questions

What does render.bench.js do?
render.bench.js is a source file in the astro codebase, written in javascript.
What does render.bench.js depend on?
render.bench.js imports 3 module(s): node:fs, node:url, vitest.
Where is render.bench.js in the architecture?
render.bench.js is located at benchmark/bench/render.bench.js (directory: benchmark/bench).

Analyze Your Own Codebase

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

Try Supermodel Free