Home / Function/ track() — svelte Function Reference

track() — svelte Function Reference

Architecture documentation for the track() function in utils.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  4f3d90b4_a0e5_f8f3_bcb7_f3b9fd6e17a8["track()"]
  323d279d_1144_2999_b739_63c889964c8c["utils.js"]
  4f3d90b4_a0e5_f8f3_bcb7_f3b9fd6e17a8 -->|defined in| 323d279d_1144_2999_b739_63c889964c8c
  14a67f99_e05c_69e9_870b_0375773b3df7["fastest_test()"]
  14a67f99_e05c_69e9_870b_0375773b3df7 -->|calls| 4f3d90b4_a0e5_f8f3_bcb7_f3b9fd6e17a8
  style 4f3d90b4_a0e5_f8f3_bcb7_f3b9fd6e17a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarking/utils.js lines 6–28

async function track(fn) {
	v8.collectGarbage();

	/** @type {PerformanceEntry[]} */
	const entries = [];

	const observer = new PerformanceObserver((list) => entries.push(...list.getEntries()));
	observer.observe({ entryTypes: ['gc'] });

	const start = performance.now();
	fn();
	const end = performance.now();

	await new Promise((f) => setTimeout(f, 10));

	const gc_time = entries
		.filter((e) => e.startTime >= start && e.startTime < end)
		.reduce((t, e) => e.duration + t, 0);

	observer.disconnect();

	return { time: end - start, gc_time };
}

Subdomains

Called By

Frequently Asked Questions

What does track() do?
track() is a function in the svelte codebase, defined in benchmarking/utils.js.
Where is track() defined?
track() is defined in benchmarking/utils.js at line 6.
What calls track()?
track() is called by 1 function(s): fastest_test.

Analyze Your Own Codebase

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

Try Supermodel Free