Home / File/ util.js — svelte Source File

util.js — svelte Source File

Architecture documentation for util.js, a javascript file in the svelte codebase. 3 imports, 2 dependents.

File javascript ReactivityBenchmarks Sbench 3 imports 2 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9["util.js"]
  323d279d_1144_2999_b739_63c889964c8c["utils.js"]
  23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9 --> 323d279d_1144_2999_b739_63c889964c8c
  14a67f99_e05c_69e9_870b_0375773b3df7["fastest_test"]
  23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9 --> 14a67f99_e05c_69e9_870b_0375773b3df7
  1a59b12b_63d5_2eb4_1881_6fb96dbdcb56["client"]
  23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9 --> 1a59b12b_63d5_2eb4_1881_6fb96dbdcb56
  187451bc_81a4_a114_ed4e_87f1321c480e["index.js"]
  187451bc_81a4_a114_ed4e_87f1321c480e --> 23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9
  0a4d017d_ab62_043a_9842_5ea5ee838412["kairo_avoidable.bench.js"]
  0a4d017d_ab62_043a_9842_5ea5ee838412 --> 23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9
  style 23b3e1d7_5601_87e8_cdcc_d7ed42c18fd9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as $ from 'svelte/internal/client';
import { fastest_test } from '../../utils.js';

export function busy() {
	let a = 0;
	for (let i = 0; i < 1_00; i++) {
		a++;
	}
}

/**
 *
 * @param {string} label
 * @param {() => { run: (i?: number) => void, destroy: () => void }} setup
 */
export function create_test(label, setup) {
	return {
		unowned: {
			label: `${label}_unowned`,
			fn: async () => {
				// Do 10 loops to warm up JIT
				for (let i = 0; i < 10; i++) {
					const { run, destroy } = setup();
					run(0);
					destroy();
				}

				const { run, destroy } = setup();

				const result = await fastest_test(10, () => {
					for (let i = 0; i < 1000; i++) {
						run(i);
					}
				});

				destroy();

				return result;
			}
		},
		owned: {
			label: `${label}_owned`,
			fn: async () => {
				let run, destroy;

				const destroy_owned = $.effect_root(() => {
					// Do 10 loops to warm up JIT
					for (let i = 0; i < 10; i++) {
						const { run, destroy } = setup();
						run(0);
						destroy();
					}

					({ run, destroy } = setup());
				});

				const result = await fastest_test(10, () => {
					for (let i = 0; i < 1000; i++) {
						run(i);
					}
				});

				// @ts-ignore
				destroy();
				destroy_owned();

				return result;
			}
		}
	};
}

Subdomains

Dependencies

Frequently Asked Questions

What does util.js do?
util.js is a source file in the svelte codebase, written in javascript. It belongs to the ReactivityBenchmarks domain, Sbench subdomain.
What functions are defined in util.js?
util.js defines 2 function(s): busy, create_test.
What does util.js depend on?
util.js imports 3 module(s): client, fastest_test, utils.js.
What files import util.js?
util.js is imported by 2 file(s): index.js, kairo_avoidable.bench.js.
Where is util.js in the architecture?
util.js is located at benchmarking/benchmarks/reactivity/util.js (domain: ReactivityBenchmarks, subdomain: Sbench, directory: benchmarking/benchmarks/reactivity).

Analyze Your Own Codebase

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

Try Supermodel Free