@fuzdev/fuz_util 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -12
  3. package/dist/async.d.ts +2 -2
  4. package/dist/async.d.ts.map +1 -1
  5. package/dist/async.js +2 -2
  6. package/dist/benchmark.d.ts +179 -0
  7. package/dist/benchmark.d.ts.map +1 -0
  8. package/dist/benchmark.js +400 -0
  9. package/dist/benchmark_baseline.d.ts +195 -0
  10. package/dist/benchmark_baseline.d.ts.map +1 -0
  11. package/dist/benchmark_baseline.js +415 -0
  12. package/dist/benchmark_format.d.ts +92 -0
  13. package/dist/benchmark_format.d.ts.map +1 -0
  14. package/dist/benchmark_format.js +327 -0
  15. package/dist/benchmark_stats.d.ts +112 -0
  16. package/dist/benchmark_stats.d.ts.map +1 -0
  17. package/dist/benchmark_stats.js +336 -0
  18. package/dist/benchmark_types.d.ts +174 -0
  19. package/dist/benchmark_types.d.ts.map +1 -0
  20. package/dist/benchmark_types.js +1 -0
  21. package/dist/library_json.d.ts +3 -3
  22. package/dist/library_json.d.ts.map +1 -1
  23. package/dist/library_json.js +1 -1
  24. package/dist/object.js +1 -1
  25. package/dist/stats.d.ts +126 -0
  26. package/dist/stats.d.ts.map +1 -0
  27. package/dist/stats.js +262 -0
  28. package/dist/time.d.ts +161 -0
  29. package/dist/time.d.ts.map +1 -0
  30. package/dist/time.js +260 -0
  31. package/dist/timings.d.ts +1 -7
  32. package/dist/timings.d.ts.map +1 -1
  33. package/dist/timings.js +16 -16
  34. package/package.json +21 -19
  35. package/src/lib/async.ts +3 -3
  36. package/src/lib/benchmark.ts +498 -0
  37. package/src/lib/benchmark_baseline.ts +573 -0
  38. package/src/lib/benchmark_format.ts +379 -0
  39. package/src/lib/benchmark_stats.ts +448 -0
  40. package/src/lib/benchmark_types.ts +197 -0
  41. package/src/lib/library_json.ts +3 -3
  42. package/src/lib/object.ts +1 -1
  43. package/src/lib/stats.ts +353 -0
  44. package/src/lib/time.ts +314 -0
  45. package/src/lib/timings.ts +17 -17
  46. package/src/lib/types.ts +2 -2
@@ -0,0 +1,415 @@
1
+ /**
2
+ * Benchmark baseline storage and comparison utilities.
3
+ * Save benchmark results to disk and compare against baselines for regression detection.
4
+ */
5
+ import { readFile, writeFile, mkdir, rm } from 'node:fs/promises';
6
+ import { join } from 'node:path';
7
+ import { z } from 'zod';
8
+ import { fs_exists } from './fs.js';
9
+ import { benchmark_stats_compare, } from './benchmark_stats.js';
10
+ // Version for forward compatibility - increment when schema changes
11
+ const BASELINE_VERSION = 1;
12
+ /**
13
+ * Schema for a single benchmark entry in the baseline.
14
+ */
15
+ export const BenchmarkBaselineEntry = z.object({
16
+ name: z.string(),
17
+ mean_ns: z.number(),
18
+ median_ns: z.number(),
19
+ std_dev_ns: z.number(),
20
+ min_ns: z.number(),
21
+ max_ns: z.number(),
22
+ p75_ns: z.number(),
23
+ p90_ns: z.number(),
24
+ p95_ns: z.number(),
25
+ p99_ns: z.number(),
26
+ ops_per_second: z.number(),
27
+ sample_size: z.number(),
28
+ });
29
+ /**
30
+ * Schema for the complete baseline file.
31
+ */
32
+ export const BenchmarkBaseline = z.object({
33
+ version: z.number(),
34
+ timestamp: z.string(),
35
+ git_commit: z.string().nullable(),
36
+ git_branch: z.string().nullable(),
37
+ node_version: z.string(),
38
+ entries: z.array(BenchmarkBaselineEntry),
39
+ });
40
+ const DEFAULT_BASELINE_PATH = '.gro/benchmarks';
41
+ const BASELINE_FILENAME = 'baseline.json';
42
+ /** Z-score for 95% confidence interval */
43
+ const Z_95 = 1.96;
44
+ /**
45
+ * Calculate 95% confidence interval from mean, std_dev, and sample_size.
46
+ */
47
+ const calculate_confidence_interval = (mean, std_dev, sample_size) => {
48
+ const margin = Z_95 * (std_dev / Math.sqrt(sample_size));
49
+ return [mean - margin, mean + margin];
50
+ };
51
+ /**
52
+ * Convert benchmark results to baseline entries.
53
+ */
54
+ const results_to_entries = (results) => {
55
+ return results.map((r) => ({
56
+ name: r.name,
57
+ mean_ns: r.stats.mean_ns,
58
+ median_ns: r.stats.median_ns,
59
+ std_dev_ns: r.stats.std_dev_ns,
60
+ min_ns: r.stats.min_ns,
61
+ max_ns: r.stats.max_ns,
62
+ p75_ns: r.stats.p75_ns,
63
+ p90_ns: r.stats.p90_ns,
64
+ p95_ns: r.stats.p95_ns,
65
+ p99_ns: r.stats.p99_ns,
66
+ ops_per_second: r.stats.ops_per_second,
67
+ sample_size: r.stats.sample_size,
68
+ }));
69
+ };
70
+ /**
71
+ * Try to get git info from the environment or git commands.
72
+ */
73
+ const get_git_info = async () => {
74
+ try {
75
+ const { promisify } = await import('node:util');
76
+ const exec = promisify((await import('node:child_process')).exec);
77
+ const [commit_result, branch_result] = await Promise.all([
78
+ exec('git rev-parse HEAD').catch(() => ({ stdout: '' })),
79
+ exec('git rev-parse --abbrev-ref HEAD').catch(() => ({ stdout: '' })),
80
+ ]);
81
+ return {
82
+ commit: commit_result.stdout.trim() || null,
83
+ branch: branch_result.stdout.trim() || null,
84
+ };
85
+ }
86
+ catch {
87
+ return { commit: null, branch: null };
88
+ }
89
+ };
90
+ /**
91
+ * Save benchmark results as the current baseline.
92
+ *
93
+ * @param results - Benchmark results to save
94
+ * @param options - Save options
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const bench = new Benchmark();
99
+ * bench.add('test', () => fn());
100
+ * await bench.run();
101
+ * await benchmark_baseline_save(bench.results());
102
+ * ```
103
+ */
104
+ export const benchmark_baseline_save = async (results, options = {}) => {
105
+ const base_path = options.path ?? DEFAULT_BASELINE_PATH;
106
+ // Get git info if not provided
107
+ let git_commit = options.git_commit;
108
+ let git_branch = options.git_branch;
109
+ if (git_commit === undefined || git_branch === undefined) {
110
+ const git_info = await get_git_info();
111
+ git_commit ??= git_info.commit;
112
+ git_branch ??= git_info.branch;
113
+ }
114
+ const baseline = {
115
+ version: BASELINE_VERSION,
116
+ timestamp: new Date().toISOString(),
117
+ git_commit,
118
+ git_branch,
119
+ node_version: process.version,
120
+ entries: results_to_entries(results),
121
+ };
122
+ await mkdir(base_path, { recursive: true });
123
+ const filepath = join(base_path, BASELINE_FILENAME);
124
+ await writeFile(filepath, JSON.stringify(baseline, null, '\t'), 'utf-8');
125
+ };
126
+ /**
127
+ * Load the current baseline from disk.
128
+ *
129
+ * @param options - Load options
130
+ * @returns The baseline, or null if not found or invalid
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const baseline = await benchmark_baseline_load();
135
+ * if (baseline) {
136
+ * console.log(`Baseline from ${baseline.timestamp}`);
137
+ * }
138
+ * ```
139
+ */
140
+ export const benchmark_baseline_load = async (options = {}) => {
141
+ const base_path = options.path ?? DEFAULT_BASELINE_PATH;
142
+ const filepath = join(base_path, BASELINE_FILENAME);
143
+ if (!(await fs_exists(filepath))) {
144
+ return null;
145
+ }
146
+ try {
147
+ const contents = await readFile(filepath, 'utf-8');
148
+ const parsed = JSON.parse(contents);
149
+ const baseline = BenchmarkBaseline.parse(parsed);
150
+ // Check version compatibility
151
+ if (baseline.version !== BASELINE_VERSION) {
152
+ // eslint-disable-next-line no-console
153
+ console.warn(`Benchmark baseline version mismatch (got ${baseline.version}, expected ${BASELINE_VERSION}). Removing stale baseline: ${filepath}`);
154
+ await rm(filepath, { force: true });
155
+ return null;
156
+ }
157
+ return baseline;
158
+ }
159
+ catch (err) {
160
+ // eslint-disable-next-line no-console
161
+ console.warn(`Invalid or corrupted benchmark baseline file. Removing: ${filepath}`, err instanceof Error ? err.message : err);
162
+ await rm(filepath, { force: true });
163
+ return null;
164
+ }
165
+ };
166
+ /**
167
+ * Compare benchmark results against the stored baseline.
168
+ *
169
+ * @param results - Current benchmark results
170
+ * @param options - Comparison options including regression threshold and staleness warning
171
+ * @returns Comparison result with regressions, improvements, and unchanged tasks
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const bench = new Benchmark();
176
+ * bench.add('test', () => fn());
177
+ * await bench.run();
178
+ *
179
+ * const comparison = await benchmark_baseline_compare(bench.results(), {
180
+ * regression_threshold: 1.05, // Only flag regressions 5% or more slower
181
+ * staleness_warning_days: 7, // Warn if baseline is older than 7 days
182
+ * });
183
+ * if (comparison.regressions.length > 0) {
184
+ * console.log('Performance regressions detected!');
185
+ * for (const r of comparison.regressions) {
186
+ * console.log(` ${r.name}: ${r.comparison.speedup_ratio.toFixed(2)}x slower`);
187
+ * }
188
+ * process.exit(1);
189
+ * }
190
+ * ```
191
+ */
192
+ export const benchmark_baseline_compare = async (results, options = {}) => {
193
+ const baseline = await benchmark_baseline_load(options);
194
+ const regression_threshold = options.regression_threshold ?? 1.0;
195
+ if (!baseline) {
196
+ return {
197
+ baseline_found: false,
198
+ baseline_timestamp: null,
199
+ baseline_commit: null,
200
+ baseline_age_days: null,
201
+ baseline_stale: false,
202
+ comparisons: [],
203
+ regressions: [],
204
+ improvements: [],
205
+ unchanged: [],
206
+ new_tasks: results.map((r) => r.name),
207
+ removed_tasks: [],
208
+ };
209
+ }
210
+ // Calculate baseline age
211
+ const baseline_date = new Date(baseline.timestamp);
212
+ const now = new Date();
213
+ const baseline_age_days = (now.getTime() - baseline_date.getTime()) / (1000 * 60 * 60 * 24);
214
+ const baseline_stale = options.staleness_warning_days !== undefined &&
215
+ baseline_age_days > options.staleness_warning_days;
216
+ const current_entries = results_to_entries(results);
217
+ const baseline_map = new Map(baseline.entries.map((e) => [e.name, e]));
218
+ const current_map = new Map(current_entries.map((e) => [e.name, e]));
219
+ const comparisons = [];
220
+ const regressions = [];
221
+ const improvements = [];
222
+ const unchanged = [];
223
+ const new_tasks = [];
224
+ const removed_tasks = [];
225
+ // Compare tasks that exist in both
226
+ for (const current of current_entries) {
227
+ const baseline_entry = baseline_map.get(current.name);
228
+ if (!baseline_entry) {
229
+ new_tasks.push(current.name);
230
+ continue;
231
+ }
232
+ // Create minimal stats objects for comparison
233
+ const baseline_stats = {
234
+ mean_ns: baseline_entry.mean_ns,
235
+ std_dev_ns: baseline_entry.std_dev_ns,
236
+ sample_size: baseline_entry.sample_size,
237
+ confidence_interval_ns: calculate_confidence_interval(baseline_entry.mean_ns, baseline_entry.std_dev_ns, baseline_entry.sample_size),
238
+ };
239
+ const current_stats = {
240
+ mean_ns: current.mean_ns,
241
+ std_dev_ns: current.std_dev_ns,
242
+ sample_size: current.sample_size,
243
+ confidence_interval_ns: calculate_confidence_interval(current.mean_ns, current.std_dev_ns, current.sample_size),
244
+ };
245
+ const comparison = benchmark_stats_compare(baseline_stats, current_stats);
246
+ const task_comparison = {
247
+ name: current.name,
248
+ baseline: baseline_entry,
249
+ current,
250
+ comparison,
251
+ };
252
+ comparisons.push(task_comparison);
253
+ // Categorize based on comparison result
254
+ // Note: comparison.faster is 'a' (baseline) or 'b' (current)
255
+ if (comparison.significant && comparison.effect_magnitude !== 'negligible') {
256
+ if (comparison.faster === 'a') {
257
+ // Baseline was faster = potential regression
258
+ // Only count as regression if it exceeds the threshold
259
+ if (comparison.speedup_ratio >= regression_threshold) {
260
+ regressions.push(task_comparison);
261
+ }
262
+ else {
263
+ unchanged.push(task_comparison);
264
+ }
265
+ }
266
+ else if (comparison.faster === 'b') {
267
+ // Current is faster = improvement
268
+ improvements.push(task_comparison);
269
+ }
270
+ else {
271
+ unchanged.push(task_comparison);
272
+ }
273
+ }
274
+ else {
275
+ unchanged.push(task_comparison);
276
+ }
277
+ }
278
+ // Find removed tasks
279
+ for (const baseline_entry of baseline.entries) {
280
+ if (!current_map.has(baseline_entry.name)) {
281
+ removed_tasks.push(baseline_entry.name);
282
+ }
283
+ }
284
+ // Sort regressions and improvements by effect size (largest first)
285
+ const sort_by_effect_size = (a, b) => b.comparison.effect_size - a.comparison.effect_size;
286
+ regressions.sort(sort_by_effect_size);
287
+ improvements.sort(sort_by_effect_size);
288
+ return {
289
+ baseline_found: true,
290
+ baseline_timestamp: baseline.timestamp,
291
+ baseline_commit: baseline.git_commit,
292
+ baseline_age_days,
293
+ baseline_stale,
294
+ comparisons,
295
+ regressions,
296
+ improvements,
297
+ unchanged,
298
+ new_tasks,
299
+ removed_tasks,
300
+ };
301
+ };
302
+ /**
303
+ * Format a baseline comparison result as a human-readable string.
304
+ *
305
+ * @param result - Comparison result from benchmark_baseline_compare
306
+ * @returns Formatted string summary
307
+ */
308
+ export const benchmark_baseline_format = (result) => {
309
+ if (!result.baseline_found) {
310
+ return 'No baseline found. Call benchmark_baseline_save() to create one.';
311
+ }
312
+ const lines = [];
313
+ lines.push(`Comparing against baseline from ${result.baseline_timestamp}`);
314
+ if (result.baseline_commit) {
315
+ lines.push(`Baseline commit: ${result.baseline_commit.slice(0, 8)}`);
316
+ }
317
+ if (result.baseline_age_days !== null) {
318
+ const age_str = result.baseline_age_days < 1
319
+ ? 'less than a day'
320
+ : result.baseline_age_days < 2
321
+ ? '1 day'
322
+ : `${Math.floor(result.baseline_age_days)} days`;
323
+ lines.push(`Baseline age: ${age_str}${result.baseline_stale ? ' (STALE)' : ''}`);
324
+ }
325
+ lines.push('');
326
+ if (result.regressions.length > 0) {
327
+ lines.push(`Regressions (${result.regressions.length}):`);
328
+ for (const r of result.regressions) {
329
+ const ratio = r.comparison.speedup_ratio.toFixed(2);
330
+ const p = r.comparison.p_value.toFixed(3);
331
+ lines.push(` ${r.name}: ${ratio}x slower (p=${p}, ${r.comparison.effect_magnitude})`);
332
+ }
333
+ lines.push('');
334
+ }
335
+ if (result.improvements.length > 0) {
336
+ lines.push(`Improvements (${result.improvements.length}):`);
337
+ for (const r of result.improvements) {
338
+ const ratio = r.comparison.speedup_ratio.toFixed(2);
339
+ const p = r.comparison.p_value.toFixed(3);
340
+ lines.push(` ${r.name}: ${ratio}x faster (p=${p}, ${r.comparison.effect_magnitude})`);
341
+ }
342
+ lines.push('');
343
+ }
344
+ if (result.unchanged.length > 0) {
345
+ lines.push(`Unchanged (${result.unchanged.length}):`);
346
+ for (const r of result.unchanged) {
347
+ lines.push(` ${r.name}`);
348
+ }
349
+ lines.push('');
350
+ }
351
+ if (result.new_tasks.length > 0) {
352
+ lines.push(`New tasks (${result.new_tasks.length}): ${result.new_tasks.join(', ')}`);
353
+ }
354
+ if (result.removed_tasks.length > 0) {
355
+ lines.push(`Removed tasks (${result.removed_tasks.length}): ${result.removed_tasks.join(', ')}`);
356
+ }
357
+ // Summary line
358
+ const total = result.comparisons.length;
359
+ const summary_parts = [];
360
+ if (result.regressions.length > 0)
361
+ summary_parts.push(`${result.regressions.length} regressions`);
362
+ if (result.improvements.length > 0)
363
+ summary_parts.push(`${result.improvements.length} improvements`);
364
+ if (result.unchanged.length > 0)
365
+ summary_parts.push(`${result.unchanged.length} unchanged`);
366
+ lines.push('');
367
+ lines.push(`Summary: ${summary_parts.join(', ')} (${total} total)`);
368
+ return lines.join('\n');
369
+ };
370
+ /**
371
+ * Format a baseline comparison result as JSON for programmatic consumption.
372
+ *
373
+ * @param result - Comparison result from benchmark_baseline_compare
374
+ * @param options - Formatting options
375
+ * @returns JSON string
376
+ */
377
+ export const benchmark_baseline_format_json = (result, options = {}) => {
378
+ const output = {
379
+ baseline_found: result.baseline_found,
380
+ baseline_timestamp: result.baseline_timestamp,
381
+ baseline_commit: result.baseline_commit,
382
+ baseline_age_days: result.baseline_age_days,
383
+ baseline_stale: result.baseline_stale,
384
+ summary: {
385
+ total: result.comparisons.length,
386
+ regressions: result.regressions.length,
387
+ improvements: result.improvements.length,
388
+ unchanged: result.unchanged.length,
389
+ new_tasks: result.new_tasks.length,
390
+ removed_tasks: result.removed_tasks.length,
391
+ },
392
+ regressions: result.regressions.map((r) => ({
393
+ name: r.name,
394
+ speedup_ratio: r.comparison.speedup_ratio,
395
+ effect_size: r.comparison.effect_size,
396
+ effect_magnitude: r.comparison.effect_magnitude,
397
+ p_value: r.comparison.p_value,
398
+ baseline_mean_ns: r.baseline.mean_ns,
399
+ current_mean_ns: r.current.mean_ns,
400
+ })),
401
+ improvements: result.improvements.map((r) => ({
402
+ name: r.name,
403
+ speedup_ratio: r.comparison.speedup_ratio,
404
+ effect_size: r.comparison.effect_size,
405
+ effect_magnitude: r.comparison.effect_magnitude,
406
+ p_value: r.comparison.p_value,
407
+ baseline_mean_ns: r.baseline.mean_ns,
408
+ current_mean_ns: r.current.mean_ns,
409
+ })),
410
+ unchanged: result.unchanged.map((r) => r.name),
411
+ new_tasks: result.new_tasks,
412
+ removed_tasks: result.removed_tasks,
413
+ };
414
+ return options.pretty ? JSON.stringify(output, null, '\t') : JSON.stringify(output);
415
+ };
@@ -0,0 +1,92 @@
1
+ import type { BenchmarkResult, BenchmarkGroup } from './benchmark_types.js';
2
+ /**
3
+ * Format results as an ASCII table with percentiles, min/max, and relative performance.
4
+ * All times use the same unit for easy comparison.
5
+ * @param results - Array of benchmark results
6
+ * @returns Formatted table string with enhanced metrics
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * console.log(benchmark_format_table(results));
11
+ * // ┌────┬─────────────┬────────────┬────────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┐
12
+ * // │ │ Task Name │ ops/sec │ median(μs) │ p75 (μs) │ p90 (μs) │ p95 (μs) │ p99 (μs) │ min (μs) │ max (μs) │ vs Best │
13
+ * // ├────┼─────────────┼────────────┼────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
14
+ * // │ 🐇 │ slugify v2 │ 1,237,144 │ 0.81 │ 0.85 │ 0.89 │ 0.95 │ 1.20 │ 0.72 │ 2.45 │ baseline │
15
+ * // │ 🐢 │ slugify │ 261,619 │ 3.82 │ 3.95 │ 4.12 │ 4.35 │ 5.10 │ 3.21 │ 12.45 │ 4.73x │
16
+ * // └────┴─────────────┴────────────┴────────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┘
17
+ * ```
18
+ *
19
+ * **Performance tier animals:**
20
+ * - 🐆 Cheetah: >1M ops/sec (extremely fast)
21
+ * - 🐇 Rabbit: >100K ops/sec (fast)
22
+ * - 🐢 Turtle: >10K ops/sec (moderate)
23
+ * - 🐌 Snail: <10K ops/sec (slow)
24
+ */
25
+ export declare const benchmark_format_table: (results: Array<BenchmarkResult>) => string;
26
+ /**
27
+ * Format results as a Markdown table with key metrics.
28
+ * All times use the same unit for easy comparison.
29
+ * @param results - Array of benchmark results
30
+ * @returns Formatted markdown table string
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * console.log(benchmark_format_markdown(results));
35
+ * // | Task Name | ops/sec | median (μs) | p75 (μs) | p90 (μs) | p95 (μs) | p99 (μs) | min (μs) | max (μs) | vs Best |
36
+ * // |------------|------------|-------------|----------|----------|----------|----------|----------|----------|----------|
37
+ * // | slugify v2 | 1,237,144 | 0.81 | 0.85 | 0.89 | 0.95 | 1.20 | 0.72 | 2.45 | baseline |
38
+ * // | slugify | 261,619 | 3.82 | 3.95 | 4.12 | 4.35 | 5.10 | 3.21 | 12.45 | 4.73x |
39
+ * ```
40
+ */
41
+ export declare const benchmark_format_markdown: (results: Array<BenchmarkResult>) => string;
42
+ export interface BenchmarkFormatJsonOptions {
43
+ /** Whether to pretty-print (default: true) */
44
+ pretty?: boolean;
45
+ /** Whether to include raw timings array (default: false, can be large) */
46
+ include_timings?: boolean;
47
+ }
48
+ /**
49
+ * Format results as JSON.
50
+ * @param results - Array of benchmark results
51
+ * @param options - Formatting options
52
+ * @returns JSON string
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * console.log(format_json(results));
57
+ * console.log(format_json(results, {pretty: false}));
58
+ * console.log(format_json(results, {include_timings: true}));
59
+ * ```
60
+ */
61
+ export declare const benchmark_format_json: (results: Array<BenchmarkResult>, options?: BenchmarkFormatJsonOptions) => string;
62
+ /**
63
+ * Format results as a grouped table with visual separators between groups.
64
+ * @param results - Array of benchmark results
65
+ * @param groups - Array of group definitions
66
+ * @returns Formatted table string with group separators
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const groups = [
71
+ * { name: 'FAST PATHS', filter: (r) => r.name.includes('fast') },
72
+ * { name: 'SLOW PATHS', filter: (r) => r.name.includes('slow') },
73
+ * ];
74
+ * console.log(benchmark_format_table_grouped(results, groups));
75
+ * // 📦 FAST PATHS
76
+ * // ┌────┬─────────────┬────────────┬...┐
77
+ * // │ 🐆 │ fast test 1 │ 1,237,144 │...│
78
+ * // │ 🐇 │ fast test 2 │ 261,619 │...│
79
+ * // └────┴─────────────┴────────────┴...┘
80
+ * //
81
+ * // 📦 SLOW PATHS
82
+ * // ┌────┬─────────────┬────────────┬...┐
83
+ * // │ 🐢 │ slow test 1 │ 10,123 │...│
84
+ * // └────┴─────────────┴────────────┴...┘
85
+ * ```
86
+ */
87
+ export declare const benchmark_format_table_grouped: (results: Array<BenchmarkResult>, groups: Array<BenchmarkGroup>) => string;
88
+ /**
89
+ * Format a number with fixed decimal places and thousands separators.
90
+ */
91
+ export declare const benchmark_format_number: (n: number, decimals?: number) => string;
92
+ //# sourceMappingURL=benchmark_format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark_format.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/benchmark_format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAC;AA8C1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,KAAK,CAAC,eAAe,CAAC,KAAG,MAmFxE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,KAAK,CAAC,eAAe,CAAC,KAAG,MA4E3E,CAAC;AAEF,MAAM,WAAW,0BAA0B;IAC1C,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,KAAK,CAAC,eAAe,CAAC,EAC/B,UAAU,0BAA0B,KAClC,MA6BF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,8BAA8B,GAC1C,SAAS,KAAK,CAAC,eAAe,CAAC,EAC/B,QAAQ,KAAK,CAAC,cAAc,CAAC,KAC3B,MA2BF,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,GAAG,MAAM,EAAE,WAAU,MAAU,KAAG,MAGzE,CAAC"}