mtrl-addons 0.2.2 → 0.2.4
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.
- package/{src/components/index.ts → dist/components/index.d.ts} +0 -2
- package/dist/components/vlist/config.d.ts +86 -0
- package/{src/components/vlist/constants.ts → dist/components/vlist/constants.d.ts} +10 -11
- package/dist/components/vlist/features/api.d.ts +7 -0
- package/{src/components/vlist/features/index.ts → dist/components/vlist/features/index.d.ts} +0 -2
- package/dist/components/vlist/features/selection.d.ts +6 -0
- package/dist/components/vlist/features/viewport.d.ts +9 -0
- package/dist/components/vlist/features.d.ts +31 -0
- package/{src/components/vlist/index.ts → dist/components/vlist/index.d.ts} +1 -10
- package/dist/components/vlist/types.d.ts +596 -0
- package/dist/components/vlist/vlist.d.ts +29 -0
- package/dist/core/compose/features/gestures/index.d.ts +86 -0
- package/dist/core/compose/features/gestures/longpress.d.ts +85 -0
- package/dist/core/compose/features/gestures/pan.d.ts +108 -0
- package/dist/core/compose/features/gestures/pinch.d.ts +111 -0
- package/dist/core/compose/features/gestures/rotate.d.ts +111 -0
- package/dist/core/compose/features/gestures/swipe.d.ts +149 -0
- package/dist/core/compose/features/gestures/tap.d.ts +79 -0
- package/{src/core/compose/features/index.ts → dist/core/compose/features/index.d.ts} +1 -2
- package/{src/core/compose/index.ts → dist/core/compose/index.d.ts} +2 -11
- package/{src/core/gestures/index.ts → dist/core/gestures/index.d.ts} +1 -20
- package/dist/core/gestures/longpress.d.ts +23 -0
- package/dist/core/gestures/manager.d.ts +14 -0
- package/dist/core/gestures/pan.d.ts +12 -0
- package/dist/core/gestures/pinch.d.ts +14 -0
- package/dist/core/gestures/rotate.d.ts +14 -0
- package/dist/core/gestures/swipe.d.ts +20 -0
- package/dist/core/gestures/tap.d.ts +12 -0
- package/dist/core/gestures/types.d.ts +320 -0
- package/dist/core/gestures/utils.d.ts +57 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/layout/config.d.ts +33 -0
- package/dist/core/layout/index.d.ts +51 -0
- package/dist/core/layout/jsx.d.ts +65 -0
- package/dist/core/layout/schema.d.ts +112 -0
- package/dist/core/layout/types.d.ts +69 -0
- package/dist/core/viewport/constants.d.ts +105 -0
- package/dist/core/viewport/features/base.d.ts +14 -0
- package/dist/core/viewport/features/collection.d.ts +41 -0
- package/dist/core/viewport/features/events.d.ts +13 -0
- package/{src/core/viewport/features/index.ts → dist/core/viewport/features/index.d.ts} +0 -7
- package/dist/core/viewport/features/item-size.d.ts +30 -0
- package/dist/core/viewport/features/loading.d.ts +34 -0
- package/dist/core/viewport/features/momentum.d.ts +17 -0
- package/dist/core/viewport/features/performance.d.ts +53 -0
- package/dist/core/viewport/features/placeholders.d.ts +38 -0
- package/dist/core/viewport/features/rendering.d.ts +16 -0
- package/dist/core/viewport/features/scrollbar.d.ts +26 -0
- package/dist/core/viewport/features/scrolling.d.ts +16 -0
- package/dist/core/viewport/features/utils.d.ts +43 -0
- package/dist/core/viewport/features/virtual.d.ts +18 -0
- package/{src/core/viewport/index.ts → dist/core/viewport/index.d.ts} +1 -17
- package/dist/core/viewport/types.d.ts +96 -0
- package/dist/core/viewport/utils/speed-tracker.d.ts +22 -0
- package/dist/core/viewport/viewport.d.ts +11 -0
- package/{src/index.ts → dist/index.d.ts} +0 -4
- package/dist/index.js +5143 -0
- package/dist/index.mjs +5111 -0
- package/dist/styles.css +254 -0
- package/dist/styles.css.map +1 -0
- package/package.json +16 -2
- package/.cursorrules +0 -117
- package/AI.md +0 -39
- package/CLAUDE.md +0 -882
- package/build.js +0 -377
- package/index.ts +0 -7
- package/scripts/analyze-orphaned-functions.ts +0 -387
- package/scripts/debug/vlist-selection.ts +0 -121
- package/src/components/vlist/config.ts +0 -323
- package/src/components/vlist/features/api.ts +0 -626
- package/src/components/vlist/features/selection.ts +0 -436
- package/src/components/vlist/features/viewport.ts +0 -59
- package/src/components/vlist/features.ts +0 -112
- package/src/components/vlist/types.ts +0 -723
- package/src/components/vlist/vlist.ts +0 -92
- package/src/core/compose/features/gestures/index.ts +0 -227
- package/src/core/compose/features/gestures/longpress.ts +0 -383
- package/src/core/compose/features/gestures/pan.ts +0 -424
- package/src/core/compose/features/gestures/pinch.ts +0 -475
- package/src/core/compose/features/gestures/rotate.ts +0 -485
- package/src/core/compose/features/gestures/swipe.ts +0 -492
- package/src/core/compose/features/gestures/tap.ts +0 -334
- package/src/core/gestures/longpress.ts +0 -68
- package/src/core/gestures/manager.ts +0 -418
- package/src/core/gestures/pan.ts +0 -48
- package/src/core/gestures/pinch.ts +0 -58
- package/src/core/gestures/rotate.ts +0 -58
- package/src/core/gestures/swipe.ts +0 -66
- package/src/core/gestures/tap.ts +0 -45
- package/src/core/gestures/types.ts +0 -387
- package/src/core/gestures/utils.ts +0 -128
- package/src/core/index.ts +0 -43
- package/src/core/layout/config.ts +0 -102
- package/src/core/layout/index.ts +0 -168
- package/src/core/layout/jsx.ts +0 -174
- package/src/core/layout/schema.ts +0 -1044
- package/src/core/layout/types.ts +0 -95
- package/src/core/viewport/constants.ts +0 -145
- package/src/core/viewport/features/base.ts +0 -73
- package/src/core/viewport/features/collection.ts +0 -1182
- package/src/core/viewport/features/events.ts +0 -130
- package/src/core/viewport/features/item-size.ts +0 -271
- package/src/core/viewport/features/loading.ts +0 -263
- package/src/core/viewport/features/momentum.ts +0 -269
- package/src/core/viewport/features/performance.ts +0 -161
- package/src/core/viewport/features/placeholders.ts +0 -335
- package/src/core/viewport/features/rendering.ts +0 -962
- package/src/core/viewport/features/scrollbar.ts +0 -434
- package/src/core/viewport/features/scrolling.ts +0 -634
- package/src/core/viewport/features/utils.ts +0 -94
- package/src/core/viewport/features/virtual.ts +0 -525
- package/src/core/viewport/types.ts +0 -133
- package/src/core/viewport/utils/speed-tracker.ts +0 -79
- package/src/core/viewport/viewport.ts +0 -265
- package/test/benchmarks/layout/advanced.test.ts +0 -656
- package/test/benchmarks/layout/comparison.test.ts +0 -519
- package/test/benchmarks/layout/performance-comparison.test.ts +0 -274
- package/test/benchmarks/layout/real-components.test.ts +0 -733
- package/test/benchmarks/layout/simple.test.ts +0 -321
- package/test/benchmarks/layout/stress.test.ts +0 -990
- package/test/collection/basic.test.ts +0 -304
- package/test/components/vlist-selection.test.ts +0 -240
- package/test/components/vlist.test.ts +0 -63
- package/test/core/collection/adapter.test.ts +0 -161
- package/test/core/collection/collection.test.ts +0 -394
- package/test/core/layout/layout.test.ts +0 -201
- package/test/utils/dom-helpers.ts +0 -275
- package/test/utils/performance-helpers.ts +0 -392
- package/tsconfig.json +0 -20
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
// test/utils/performance-helpers.ts - Performance Testing Utilities
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Measures the execution time of a function
|
|
5
|
-
* @param callback - Function to measure
|
|
6
|
-
* @returns Promise that resolves with the execution time in milliseconds
|
|
7
|
-
*/
|
|
8
|
-
export function measureExecutionTime(
|
|
9
|
-
callback: () => Promise<void> | void
|
|
10
|
-
): Promise<number> {
|
|
11
|
-
return new Promise(async (resolve) => {
|
|
12
|
-
const start = performance.now();
|
|
13
|
-
await callback();
|
|
14
|
-
const end = performance.now();
|
|
15
|
-
resolve(end - start);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Measures the time it takes to render content
|
|
21
|
-
* @param callback - Render function
|
|
22
|
-
* @returns Promise that resolves with render time in milliseconds
|
|
23
|
-
*/
|
|
24
|
-
export function measureRenderTime(
|
|
25
|
-
callback: () => Promise<void> | void
|
|
26
|
-
): Promise<number> {
|
|
27
|
-
return measureExecutionTime(callback);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Creates a large dataset for performance testing
|
|
32
|
-
* @param count - Number of items to create
|
|
33
|
-
* @param template - Template function for creating items
|
|
34
|
-
* @returns Array of test items
|
|
35
|
-
*/
|
|
36
|
-
export function createLargeDataset<T>(
|
|
37
|
-
count: number = 10000,
|
|
38
|
-
template: (index: number) => T = (i) =>
|
|
39
|
-
({
|
|
40
|
-
id: i.toString(),
|
|
41
|
-
name: `Item ${i}`,
|
|
42
|
-
value: Math.random() * 1000,
|
|
43
|
-
} as T)
|
|
44
|
-
): T[] {
|
|
45
|
-
return Array.from({ length: count }, (_, i) => template(i));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Creates test items with varying sizes for dynamic height testing
|
|
50
|
-
* @param count - Number of items to create
|
|
51
|
-
* @returns Array of items with different content lengths
|
|
52
|
-
*/
|
|
53
|
-
export function createVariableSizeDataset(count: number = 1000) {
|
|
54
|
-
return Array.from({ length: count }, (_, i) => ({
|
|
55
|
-
id: i.toString(),
|
|
56
|
-
name: `Item ${i}`,
|
|
57
|
-
description: "Lorem ipsum ".repeat(Math.floor(Math.random() * 10) + 1),
|
|
58
|
-
tags: Array.from(
|
|
59
|
-
{ length: Math.floor(Math.random() * 5) + 1 },
|
|
60
|
-
(_, j) => `tag${j}`
|
|
61
|
-
),
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Measures frame rate during a series of operations
|
|
67
|
-
* @param operations - Array of operations to perform
|
|
68
|
-
* @param duration - Duration to measure in milliseconds
|
|
69
|
-
* @returns Promise that resolves with average FPS
|
|
70
|
-
*/
|
|
71
|
-
export function measureFrameRate(
|
|
72
|
-
operations: (() => void)[],
|
|
73
|
-
duration: number = 1000
|
|
74
|
-
): Promise<number> {
|
|
75
|
-
return new Promise((resolve) => {
|
|
76
|
-
let frameCount = 0;
|
|
77
|
-
let lastTime = performance.now();
|
|
78
|
-
const endTime = lastTime + duration;
|
|
79
|
-
let operationIndex = 0;
|
|
80
|
-
|
|
81
|
-
function frame() {
|
|
82
|
-
const currentTime = performance.now();
|
|
83
|
-
|
|
84
|
-
if (currentTime >= endTime) {
|
|
85
|
-
const fps = (frameCount / duration) * 1000;
|
|
86
|
-
resolve(fps);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Perform operation
|
|
91
|
-
if (operations.length > 0) {
|
|
92
|
-
operations[operationIndex % operations.length]();
|
|
93
|
-
operationIndex++;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
frameCount++;
|
|
97
|
-
requestAnimationFrame(frame);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
requestAnimationFrame(frame);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Measures scroll performance by simulating rapid scrolling
|
|
106
|
-
* @param container - Container element to scroll
|
|
107
|
-
* @param scrollDistance - Total distance to scroll
|
|
108
|
-
* @param scrollSteps - Number of scroll steps
|
|
109
|
-
* @returns Promise that resolves with performance metrics
|
|
110
|
-
*/
|
|
111
|
-
export function measureScrollPerformance(
|
|
112
|
-
container: HTMLElement,
|
|
113
|
-
scrollDistance: number = 10000,
|
|
114
|
-
scrollSteps: number = 100
|
|
115
|
-
): Promise<{
|
|
116
|
-
averageFrameTime: number;
|
|
117
|
-
maxFrameTime: number;
|
|
118
|
-
minFrameTime: number;
|
|
119
|
-
droppedFrames: number;
|
|
120
|
-
}> {
|
|
121
|
-
return new Promise((resolve) => {
|
|
122
|
-
const frameTimes: number[] = [];
|
|
123
|
-
const stepSize = scrollDistance / scrollSteps;
|
|
124
|
-
let currentStep = 0;
|
|
125
|
-
let lastTime = performance.now();
|
|
126
|
-
const targetFrameTime = 16.67; // 60fps = 16.67ms per frame
|
|
127
|
-
|
|
128
|
-
function scrollStep() {
|
|
129
|
-
const currentTime = performance.now();
|
|
130
|
-
const frameTime = currentTime - lastTime;
|
|
131
|
-
frameTimes.push(frameTime);
|
|
132
|
-
|
|
133
|
-
if (currentStep >= scrollSteps) {
|
|
134
|
-
const averageFrameTime =
|
|
135
|
-
frameTimes.reduce((a, b) => a + b, 0) / frameTimes.length;
|
|
136
|
-
const maxFrameTime = Math.max(...frameTimes);
|
|
137
|
-
const minFrameTime = Math.min(...frameTimes);
|
|
138
|
-
const droppedFrames = frameTimes.filter(
|
|
139
|
-
(time) => time > targetFrameTime
|
|
140
|
-
).length;
|
|
141
|
-
|
|
142
|
-
resolve({
|
|
143
|
-
averageFrameTime,
|
|
144
|
-
maxFrameTime,
|
|
145
|
-
minFrameTime,
|
|
146
|
-
droppedFrames,
|
|
147
|
-
});
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Perform scroll
|
|
152
|
-
container.scrollTop = currentStep * stepSize;
|
|
153
|
-
const scrollEvent = new Event("scroll", { bubbles: true });
|
|
154
|
-
container.dispatchEvent(scrollEvent);
|
|
155
|
-
|
|
156
|
-
currentStep++;
|
|
157
|
-
lastTime = currentTime;
|
|
158
|
-
requestAnimationFrame(scrollStep);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
requestAnimationFrame(scrollStep);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Measures memory usage (approximate)
|
|
167
|
-
* @returns Memory usage information
|
|
168
|
-
*/
|
|
169
|
-
export function measureMemoryUsage(): {
|
|
170
|
-
heapUsed: number;
|
|
171
|
-
heapTotal: number;
|
|
172
|
-
external: number;
|
|
173
|
-
} {
|
|
174
|
-
// For browser environment, we can't access precise memory info
|
|
175
|
-
// This is a placeholder that would work in Node.js
|
|
176
|
-
if (typeof process !== "undefined" && process.memoryUsage) {
|
|
177
|
-
const usage = process.memoryUsage();
|
|
178
|
-
return {
|
|
179
|
-
heapUsed: usage.heapUsed,
|
|
180
|
-
heapTotal: usage.heapTotal,
|
|
181
|
-
external: usage.external,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Browser fallback - approximate values
|
|
186
|
-
return {
|
|
187
|
-
heapUsed: 0,
|
|
188
|
-
heapTotal: 0,
|
|
189
|
-
external: 0,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Measures DOM manipulation performance
|
|
195
|
-
* @param manipulationFn - Function that performs DOM manipulation
|
|
196
|
-
* @param iterations - Number of iterations to perform
|
|
197
|
-
* @returns Promise that resolves with performance metrics
|
|
198
|
-
*/
|
|
199
|
-
export function measureDOMPerformance(
|
|
200
|
-
manipulationFn: () => void,
|
|
201
|
-
iterations: number = 1000
|
|
202
|
-
): Promise<{
|
|
203
|
-
totalTime: number;
|
|
204
|
-
averageTime: number;
|
|
205
|
-
operationsPerSecond: number;
|
|
206
|
-
}> {
|
|
207
|
-
return new Promise((resolve) => {
|
|
208
|
-
const start = performance.now();
|
|
209
|
-
|
|
210
|
-
for (let i = 0; i < iterations; i++) {
|
|
211
|
-
manipulationFn();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const end = performance.now();
|
|
215
|
-
const totalTime = end - start;
|
|
216
|
-
const averageTime = totalTime / iterations;
|
|
217
|
-
const operationsPerSecond = (iterations / totalTime) * 1000;
|
|
218
|
-
|
|
219
|
-
resolve({
|
|
220
|
-
totalTime,
|
|
221
|
-
averageTime,
|
|
222
|
-
operationsPerSecond,
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Runs a performance benchmark and compares against baseline
|
|
229
|
-
* @param name - Name of the benchmark
|
|
230
|
-
* @param fn - Function to benchmark
|
|
231
|
-
* @param baseline - Baseline time in milliseconds
|
|
232
|
-
* @returns Promise that resolves with benchmark results
|
|
233
|
-
*/
|
|
234
|
-
export function runBenchmark(
|
|
235
|
-
name: string,
|
|
236
|
-
fn: () => Promise<void> | void,
|
|
237
|
-
baseline?: number
|
|
238
|
-
): Promise<{
|
|
239
|
-
name: string;
|
|
240
|
-
time: number;
|
|
241
|
-
baseline?: number;
|
|
242
|
-
ratio?: number;
|
|
243
|
-
passed: boolean;
|
|
244
|
-
}> {
|
|
245
|
-
return new Promise(async (resolve) => {
|
|
246
|
-
const time = await measureExecutionTime(fn);
|
|
247
|
-
const result = {
|
|
248
|
-
name,
|
|
249
|
-
time,
|
|
250
|
-
baseline,
|
|
251
|
-
ratio: baseline ? time / baseline : undefined,
|
|
252
|
-
passed: baseline ? time <= baseline : true,
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
resolve(result);
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Stress tests a function with increasing load
|
|
261
|
-
* @param fn - Function to stress test
|
|
262
|
-
* @param startLoad - Starting load (e.g., number of items)
|
|
263
|
-
* @param maxLoad - Maximum load to test
|
|
264
|
-
* @param stepSize - Step size for increasing load
|
|
265
|
-
* @returns Promise that resolves with stress test results
|
|
266
|
-
*/
|
|
267
|
-
export function stressTest(
|
|
268
|
-
fn: (load: number) => Promise<void> | void,
|
|
269
|
-
startLoad: number = 100,
|
|
270
|
-
maxLoad: number = 10000,
|
|
271
|
-
stepSize: number = 100
|
|
272
|
-
): Promise<
|
|
273
|
-
{
|
|
274
|
-
load: number;
|
|
275
|
-
time: number;
|
|
276
|
-
success: boolean;
|
|
277
|
-
}[]
|
|
278
|
-
> {
|
|
279
|
-
return new Promise(async (resolve) => {
|
|
280
|
-
const results: { load: number; time: number; success: boolean }[] = [];
|
|
281
|
-
|
|
282
|
-
for (let load = startLoad; load <= maxLoad; load += stepSize) {
|
|
283
|
-
try {
|
|
284
|
-
const time = await measureExecutionTime(() => fn(load));
|
|
285
|
-
results.push({ load, time, success: true });
|
|
286
|
-
} catch (error) {
|
|
287
|
-
results.push({ load, time: -1, success: false });
|
|
288
|
-
break; // Stop on first failure
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
resolve(results);
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Measures the performance of virtual scrolling
|
|
298
|
-
* @param container - Container element
|
|
299
|
-
* @param itemCount - Total number of items
|
|
300
|
-
* @param visibleItems - Number of visible items
|
|
301
|
-
* @param scrollTests - Number of scroll positions to test
|
|
302
|
-
* @returns Promise that resolves with virtual scroll performance metrics
|
|
303
|
-
*/
|
|
304
|
-
export function measureVirtualScrollPerformance(
|
|
305
|
-
container: HTMLElement,
|
|
306
|
-
itemCount: number = 10000,
|
|
307
|
-
visibleItems: number = 20,
|
|
308
|
-
scrollTests: number = 100
|
|
309
|
-
): Promise<{
|
|
310
|
-
renderTime: number;
|
|
311
|
-
scrollTime: number;
|
|
312
|
-
memoryEfficiency: number;
|
|
313
|
-
}> {
|
|
314
|
-
return new Promise(async (resolve) => {
|
|
315
|
-
// Measure initial render time
|
|
316
|
-
const renderTime = await measureRenderTime(async () => {
|
|
317
|
-
// This would be the virtual scroll render function
|
|
318
|
-
// Placeholder for now
|
|
319
|
-
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
// Measure scroll performance
|
|
323
|
-
const scrollTime = await measureScrollPerformance(
|
|
324
|
-
container,
|
|
325
|
-
5000,
|
|
326
|
-
scrollTests
|
|
327
|
-
);
|
|
328
|
-
|
|
329
|
-
// Calculate memory efficiency (visible items / total items)
|
|
330
|
-
const memoryEfficiency = visibleItems / itemCount;
|
|
331
|
-
|
|
332
|
-
resolve({
|
|
333
|
-
renderTime,
|
|
334
|
-
scrollTime: scrollTime.averageFrameTime,
|
|
335
|
-
memoryEfficiency,
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Creates a performance test suite
|
|
342
|
-
* @param tests - Array of test configurations
|
|
343
|
-
* @returns Promise that resolves with all test results
|
|
344
|
-
*/
|
|
345
|
-
export function runPerformanceTestSuite(
|
|
346
|
-
tests: {
|
|
347
|
-
name: string;
|
|
348
|
-
fn: () => Promise<void> | void;
|
|
349
|
-
baseline?: number;
|
|
350
|
-
timeout?: number;
|
|
351
|
-
}[]
|
|
352
|
-
): Promise<
|
|
353
|
-
{
|
|
354
|
-
name: string;
|
|
355
|
-
time: number;
|
|
356
|
-
baseline?: number;
|
|
357
|
-
passed: boolean;
|
|
358
|
-
error?: string;
|
|
359
|
-
}[]
|
|
360
|
-
> {
|
|
361
|
-
return new Promise(async (resolve) => {
|
|
362
|
-
const results: {
|
|
363
|
-
name: string;
|
|
364
|
-
time: number;
|
|
365
|
-
baseline?: number;
|
|
366
|
-
passed: boolean;
|
|
367
|
-
error?: string;
|
|
368
|
-
}[] = [];
|
|
369
|
-
|
|
370
|
-
for (const test of tests) {
|
|
371
|
-
try {
|
|
372
|
-
const benchmark = await runBenchmark(test.name, test.fn, test.baseline);
|
|
373
|
-
results.push({
|
|
374
|
-
name: benchmark.name,
|
|
375
|
-
time: benchmark.time,
|
|
376
|
-
baseline: benchmark.baseline,
|
|
377
|
-
passed: benchmark.passed,
|
|
378
|
-
});
|
|
379
|
-
} catch (error) {
|
|
380
|
-
results.push({
|
|
381
|
-
name: test.name,
|
|
382
|
-
time: -1,
|
|
383
|
-
baseline: test.baseline,
|
|
384
|
-
passed: false,
|
|
385
|
-
error: error instanceof Error ? error.message : String(error),
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
resolve(results);
|
|
391
|
-
});
|
|
392
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"rootDir": "src",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"lib": ["ESNext", "DOM"],
|
|
13
|
-
"types": ["bun-types"],
|
|
14
|
-
"paths": {
|
|
15
|
-
"@/*": ["./src/*"]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*.ts"],
|
|
19
|
-
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
20
|
-
}
|