MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / measure

Function measure

src/scripts/measure-throughput.ts:58–75  ·  view source on GitHub ↗
(framework: string)

Source from the content-addressed store, hash-verified

56);
57
58async function measure(framework: string) {
59 const { process: runningProcess, port } = await preview(framework);
60 // Hydrogen has a very long boot up period as it is launchhing miniflare
61 await sleep(framework === 'hydrogen' ? 15000 : 5000);
62
63 const usePath = ssrPathMap[framework]?.[path] || path;
64 const measureUrl = `http://localhost:${port}${usePath}`;
65
66 const result = (resultsMap[framework] = await measureTimeForRequests(
67 measureUrl
68 ));
69
70 console.info(chalk.green(`Done with ${framework}:`), result);
71
72 // Don't throw an error when we kill the process below
73 runningProcess.catch(() => null);
74 await runningProcess.kill();
75}
76
77async function measureTimeForRequests(url: string) {
78 const result = await autocannon({

Callers 1

Calls 2

previewFunction · 0.85
measureTimeForRequestsFunction · 0.70

Tested by

no test coverage detected