Home / File/ kairo_unstable.bench.js — svelte Source File

kairo_unstable.bench.js — svelte Source File

Architecture documentation for kairo_unstable.bench.js, a javascript file in the svelte codebase. 2 imports, 0 dependents.

File javascript 2 imports

Entity Profile

Dependency Diagram

graph LR
  6e8b2757_2717_1f56_c435_6b4a35c835b5["kairo_unstable.bench.js"]
  d3dc1520_5a13_e6ad_9208_466ecffe2410["node:assert"]
  6e8b2757_2717_1f56_c435_6b4a35c835b5 --> d3dc1520_5a13_e6ad_9208_466ecffe2410
  1a59b12b_63d5_2eb4_1881_6fb96dbdcb56["client"]
  6e8b2757_2717_1f56_c435_6b4a35c835b5 --> 1a59b12b_63d5_2eb4_1881_6fb96dbdcb56
  style 6e8b2757_2717_1f56_c435_6b4a35c835b5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert';
import * as $ from 'svelte/internal/client';

export default () => {
	let head = $.state(0);
	const double = $.derived(() => $.get(head) * 2);
	const inverse = $.derived(() => -$.get(head));
	let current = $.derived(() => {
		let result = 0;
		for (let i = 0; i < 20; i++) {
			result += $.get(head) % 2 ? $.get(double) : $.get(inverse);
		}
		return result;
	});

	let counter = 0;

	const destroy = $.effect_root(() => {
		$.render_effect(() => {
			$.get(current);
			counter++;
		});
	});

	return {
		destroy,
		run() {
			$.flush(() => {
				$.set(head, 1);
			});
			assert.equal($.get(current), 40);
			counter = 0;
			for (let i = 0; i < 100; i++) {
				$.flush(() => {
					$.set(head, i);
				});
			}
			assert.equal(counter, 100);
		}
	};
};

Dependencies

  • client
  • node:assert

Frequently Asked Questions

What does kairo_unstable.bench.js do?
kairo_unstable.bench.js is a source file in the svelte codebase, written in javascript.
What does kairo_unstable.bench.js depend on?
kairo_unstable.bench.js imports 2 module(s): client, node:assert.
Where is kairo_unstable.bench.js in the architecture?
kairo_unstable.bench.js is located at benchmarking/benchmarks/reactivity/tests/kairo_unstable.bench.js (directory: benchmarking/benchmarks/reactivity/tests).

Analyze Your Own Codebase

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

Try Supermodel Free