run.js — svelte Source File
Architecture documentation for run.js, a javascript file in the svelte codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4bccdabb_8174_58f8_fd43_e875402eede5["run.js"] a90e5ee7_62bf_5257_b6d7_6579a13ff90b["index.js"] 4bccdabb_8174_58f8_fd43_e875402eede5 --> a90e5ee7_62bf_5257_b6d7_6579a13ff90b 187451bc_81a4_a114_ed4e_87f1321c480e["index.js"] 4bccdabb_8174_58f8_fd43_e875402eede5 --> 187451bc_81a4_a114_ed4e_87f1321c480e 116006f2_8fe2_f720_f19f_6006895ac4b5["index.js"] 4bccdabb_8174_58f8_fd43_e875402eede5 --> 116006f2_8fe2_f720_f19f_6006895ac4b5 style 4bccdabb_8174_58f8_fd43_e875402eede5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as $ from '../packages/svelte/src/internal/client/index.js';
import { reactivity_benchmarks } from './benchmarks/reactivity/index.js';
import { ssr_benchmarks } from './benchmarks/ssr/index.js';
// e.g. `pnpm bench kairo` to only run the kairo benchmarks
const filters = process.argv.slice(2);
const suites = [
{
benchmarks: reactivity_benchmarks.filter(
(b) => filters.length === 0 || filters.some((f) => b.label.includes(f))
),
name: 'reactivity benchmarks'
},
{
benchmarks: ssr_benchmarks.filter(
(b) => filters.length === 0 || filters.some((f) => b.label.includes(f))
),
name: 'server-side rendering benchmarks'
}
].filter((suite) => suite.benchmarks.length > 0);
if (suites.length === 0) {
console.log('No benchmarks matched provided filters');
process.exit(1);
}
const COLUMN_WIDTHS = [25, 9, 9];
const TOTAL_WIDTH = COLUMN_WIDTHS.reduce((a, b) => a + b);
const pad_right = (str, n) => str + ' '.repeat(n - str.length);
const pad_left = (str, n) => ' '.repeat(n - str.length) + str;
let total_time = 0;
let total_gc_time = 0;
$.push({}, true);
try {
for (const { benchmarks, name } of suites) {
let suite_time = 0;
let suite_gc_time = 0;
console.log(`\nRunning ${name}...\n`);
console.log(
pad_right('Benchmark', COLUMN_WIDTHS[0]) +
pad_left('Time', COLUMN_WIDTHS[1]) +
pad_left('GC time', COLUMN_WIDTHS[2])
);
console.log('='.repeat(TOTAL_WIDTH));
for (const benchmark of benchmarks) {
const results = await benchmark.fn();
console.log(
pad_right(benchmark.label, COLUMN_WIDTHS[0]) +
pad_left(results.time.toFixed(2), COLUMN_WIDTHS[1]) +
pad_left(results.gc_time.toFixed(2), COLUMN_WIDTHS[2])
);
total_time += results.time;
total_gc_time += results.gc_time;
suite_time += results.time;
suite_gc_time += results.gc_time;
}
console.log('='.repeat(TOTAL_WIDTH));
console.log(
pad_right('suite', COLUMN_WIDTHS[0]) +
pad_left(suite_time.toFixed(2), COLUMN_WIDTHS[1]) +
pad_left(suite_gc_time.toFixed(2), COLUMN_WIDTHS[2])
);
console.log('='.repeat(TOTAL_WIDTH));
}
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
}
$.pop();
console.log('');
console.log(
pad_right('total', COLUMN_WIDTHS[0]) +
pad_left(total_time.toFixed(2), COLUMN_WIDTHS[1]) +
pad_left(total_gc_time.toFixed(2), COLUMN_WIDTHS[2])
);
Domain
Subdomains
Source
Frequently Asked Questions
What does run.js do?
run.js is a source file in the svelte codebase, written in javascript. It belongs to the ReactivityBenchmarks domain, Runner subdomain.
What functions are defined in run.js?
run.js defines 4 function(s): TOTAL_WIDTH, pad_left, pad_right, suites.
What does run.js depend on?
run.js imports 3 module(s): index.js, index.js, index.js.
Where is run.js in the architecture?
run.js is located at benchmarking/run.js (domain: ReactivityBenchmarks, subdomain: Runner, directory: benchmarking).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free