@smartnet360/svelte-components 0.0.123 → 0.0.124

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.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Benchmark utilities for measuring Svelte reactivity performance
3
+ */
4
+ /**
5
+ * Generate test data array
6
+ */
7
+ export function generateTestData(count) {
8
+ const categories = ['A', 'B', 'C', 'D', 'E'];
9
+ const items = [];
10
+ for (let i = 0; i < count; i++) {
11
+ items.push({
12
+ id: i,
13
+ name: `Item ${i}`,
14
+ value: Math.random() * 1000,
15
+ category: categories[i % categories.length],
16
+ active: i % 2 === 0,
17
+ data: Array.from({ length: 10 }, () => Math.random() * 100)
18
+ });
19
+ }
20
+ return items;
21
+ }
22
+ /**
23
+ * Measure execution time of a function
24
+ */
25
+ export function measure(fn) {
26
+ const start = performance.now();
27
+ const result = fn();
28
+ const duration = performance.now() - start;
29
+ return { result, duration };
30
+ }
31
+ /**
32
+ * Measure async execution time
33
+ */
34
+ export async function measureAsync(fn) {
35
+ const start = performance.now();
36
+ const result = await fn();
37
+ const duration = performance.now() - start;
38
+ return { result, duration };
39
+ }
40
+ /**
41
+ * Format duration for display
42
+ */
43
+ export function formatDuration(ms) {
44
+ if (ms < 1) {
45
+ return `${(ms * 1000).toFixed(2)} µs`;
46
+ }
47
+ else if (ms < 1000) {
48
+ return `${ms.toFixed(2)} ms`;
49
+ }
50
+ else {
51
+ return `${(ms / 1000).toFixed(2)} s`;
52
+ }
53
+ }
54
+ /**
55
+ * Create a detailed log entry
56
+ */
57
+ export function logBenchmark(result) {
58
+ const opsFormatted = result.opsPerSecond > 1000
59
+ ? `${(result.opsPerSecond / 1000).toFixed(2)}K ops/s`
60
+ : `${result.opsPerSecond.toFixed(2)} ops/s`;
61
+ console.log(`%c[BENCHMARK] ${result.name}%c\n` +
62
+ ` Duration: ${formatDuration(result.duration)}\n` +
63
+ ` Items: ${result.itemCount.toLocaleString()}\n` +
64
+ ` Performance: ${opsFormatted}`, 'color: #4CAF50; font-weight: bold;', 'color: inherit;');
65
+ }
66
+ /**
67
+ * Run a benchmark and return result
68
+ */
69
+ export function runBenchmark(name, fn, itemCount) {
70
+ const { duration } = measure(fn);
71
+ const result = {
72
+ name,
73
+ duration,
74
+ itemCount,
75
+ opsPerSecond: (itemCount / duration) * 1000,
76
+ timestamp: new Date()
77
+ };
78
+ logBenchmark(result);
79
+ return result;
80
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Benchmark } from './Benchmark.svelte';
2
+ export * from './benchmark-utils';
@@ -0,0 +1,3 @@
1
+ // Benchmark component for testing Svelte reactivity performance
2
+ export { default as Benchmark } from './Benchmark.svelte';
3
+ export * from './benchmark-utils';
@@ -5,3 +5,4 @@ export * from './Settings/index.js';
5
5
  export * from './logger/index.js';
6
6
  export * from './CellTable/index.js';
7
7
  export * from './FeatureRegistry/index.js';
8
+ export * from './Benchmark/index.js';
@@ -17,3 +17,5 @@ export * from './CellTable/index.js';
17
17
  // export * from './Map/index.js';
18
18
  // FeatureRegistry - Component access management
19
19
  export * from './FeatureRegistry/index.js';
20
+ // Benchmark - Performance testing for Svelte reactivity
21
+ export * from './Benchmark/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.123",
3
+ "version": "0.0.124",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",