Files
WRNexusJSDoc/app/pages/packages/benchmark.wrn
T

68 lines
6.0 KiB
Plaintext

page wrnexusbenchmark {
seo {
title = "@wrnexus/benchmark"
description = "Framework benchmark scenarios and repeatable performance measurements."
}
view {
<div class="docs-shell">
<a href="#main" class="skip-link">Skip to content</a>
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.8.5</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout">
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/benchmark</span></nav><section class="doc-intro"><span class="eyebrow">Tooling · Package reference</span><h1>@wrnexus/benchmark</h1><p>Framework benchmark scenarios and repeatable performance measurements.</p><div class="doc-meta"><span>v0.8.5</span><span>Private registry</span><span>Tooling</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/benchmark@0.8.5</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><p>Deterministic benchmark execution, percentiles, baseline comparisons, and regression budgets for builds, SSR, hydration, stores, and application hot paths.</p>
<pre data-language="ts"><code>import &#123; runBenchmark, assertBenchmarkBudget &#125; from &quot;@wrnexus/benchmark&quot;;
const result = await runBenchmark(&quot;render&quot;, render, &#123; iterations: 100 &#125;);
assertBenchmarkBudget(result, baseline, &#123; p95Percent: 5 &#125;);</code></pre></section><section id="api" class="api"><h2>Complete TypeScript API</h2><p>Generated from the exact installed package declarations.</p><pre data-language="typescript"><code>interface BenchmarkOptions &#123;
iterations?: number;
warmup?: number;
clock?: () =&gt; number;
setup?: () =&gt; void | Promise&lt;void&gt;;
teardown?: () =&gt; void | Promise&lt;void&gt;;
&#125;
interface BenchmarkResult &#123;
name: string;
iterations: number;
totalMs: number;
meanMs: number;
minMs: number;
maxMs: number;
p50Ms: number;
p95Ms: number;
p99Ms: number;
operationsPerSecond: number;
samples: number[];
&#125;
interface RegressionBudget &#123;
meanPercent?: number;
p95Percent?: number;
maxAbsoluteMs?: number;
minOperationsPerSecond?: number;
&#125;
interface RegressionViolation &#123;
metric: &quot;meanMs&quot; | &quot;p95Ms&quot; | &quot;maxMs&quot; | &quot;operationsPerSecond&quot;;
baseline?: number;
current: number;
limit: number;
message: string;
&#125;
declare function percentile(values: readonly number[], quantile: number): number;
declare function runBenchmark(name: string, operation: () =&gt; void | Promise&lt;void&gt;, options?: BenchmarkOptions): Promise&lt;BenchmarkResult&gt;;
declare function compareBenchmark(current: BenchmarkResult, baseline: BenchmarkResult | undefined, budget?: RegressionBudget): RegressionViolation[];
declare function assertBenchmarkBudget(current: BenchmarkResult, baseline: BenchmarkResult | undefined, budget: RegressionBudget): void;
export &#123; type BenchmarkOptions, type BenchmarkResult, type RegressionBudget, type RegressionViolation, assertBenchmarkBudget, compareBenchmark, percentile, runBenchmark &#125;;
</code></pre></section><section id="examples" class="examples"><h2>Examples</h2><p>Copy-ready examples from the installed package documentation.</p><div class="example-grid"><article class="example-card"><h3>Deterministic benchmark execution, percentiles, baseline comparisons, and regression budgets for builds, SSR, hydration, stores, and application hot paths.</h3><pre data-language="ts"><code>import &#123; runBenchmark, assertBenchmarkBudget &#125; from &quot;@wrnexus/benchmark&quot;;
const result = await runBenchmark(&quot;render&quot;, render, &#123; iterations: 100 &#125;);
assertBenchmarkBudget(result, baseline, &#123; p95Percent: 5 &#125;);</code></pre></article><article class="example-card"><h3>Install @wrnexus/benchmark</h3><pre data-language="sh"><code>bun add @wrnexus/benchmark</code></pre></article></div></section></article>
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
</main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.8.5</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
</div>
}
}