@heswell/vuu-data-engine-local 4.2.4 → 4.3.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 (2) hide show
  1. package/README.md +58 -1
  2. package/package.json +10 -10
package/README.md CHANGED
@@ -7,7 +7,8 @@ engine runs in the vuu-websocket (Bun) server.
7
7
 
8
8
  The package runs alongside `@vuu-ui/vuu-data-test` and has the same public API. It is
9
9
  meant to replace the `VuuModule` / `TickingArrayDataSource` core in that package. The
10
- two packages don't depend on each other.
10
+ two packages don't depend on each other. To move an app across, see
11
+ [MIGRATING.md](./MIGRATING.md).
11
12
 
12
13
  ## Peer dependencies
13
14
 
@@ -302,6 +303,10 @@ Mean time per operation, 100k rows, Node 24, Apple Silicon:
302
303
  | 1000 ticks, grouped | 1205 ms | 0.39 ms | ~3100x |
303
304
  | 500 deletes + 500 inserts | 1628 ms | 0.60 ms | ~2700x |
304
305
  | 500 deletes + 500 inserts, sorted | 2564 ms | 1.57 ms | ~1600x |
306
+ | switch aggregation sets, grouped | 5.9 ms | 5.4 ms | 1.1x |
307
+ | groupBy ccy + exchange, aggregated, set/clear | 3.2 ms | 3.6 ms | 0.9x |
308
+ | expand/collapse one group | 1840 ms | 0.044 ms | ~42000x |
309
+ | 1000 ticks, grouped, aggregated, expanded | 1704 ms | 0.70 ms | ~2500x |
305
310
 
306
311
  Notes:
307
312
 
@@ -311,6 +316,55 @@ Notes:
311
316
  comparisons understate the engine's advantage.
312
317
  - Scrolling: the engine uses an array-backed row key allocator (`RowKeys`) and prunes its row
313
318
  cache incrementally, so range changes cost in proportion to the rows entering or leaving the range.
319
+ - Aggregations: switching sets and grouping with aggregations cost about the same in both, but
320
+ with the four-column set legacy fills in only one aggregate and leaves values from the previous
321
+ set behind, so it does less work. The legacy
322
+ bench can't clear aggregations, because `aggregations = []` throws on a grouped legacy data source.
323
+ - Expand/collapse: legacy rebuilds the expanded rows from every open node on each change.
324
+ Expanding all groups was dropped from the comparison because legacy takes several
325
+ seconds per run even at 10k rows. The 1M-row bench below covers it for the engine.
326
+
327
+ ### 1M rows, engine only
328
+
329
+ `bench/scale.bench-run.ts` measures the engine alone at 1M rows, with heap use. A legacy
330
+ comparison is impractical at this size. It runs under vitest in Node with `--expose-gc`,
331
+ using `vitest.scale.config.ts`. Each timing is the median of 5 runs after a warmup. Heap is
332
+ V8 `heapUsed` after a full GC.
333
+
334
+ ```sh
335
+ npm run bench:data-engine-local:1m
336
+ SCALE_ROWS=200000 npm run bench:scale -w @heswell/vuu-data-engine-local
337
+ SCALE_OUT=/tmp/scale.json npm run bench:scale -w @heswell/vuu-data-engine-local
338
+ ```
339
+
340
+ The `Performance` workflow runs it at 1M rows and charts the results as `local-scale.*`.
341
+
342
+ Results at 1M rows, Node 24, Apple Silicon:
343
+
344
+ | Measurement | Result |
345
+ | ---------------------------------------------------------- | -------- |
346
+ | heap: source row arrays (context) | 182 MB |
347
+ | heap: table (rows + key index) | 222 MB |
348
+ | heap: sorted data source | 0.2 MB |
349
+ | heap: grouped data source (2 levels, 4 aggregations, expanded) | 16 MB |
350
+ | build table | 262 ms |
351
+ | create + subscribe | 4.4 ms |
352
+ | sort numeric column | 223 ms |
353
+ | sort two columns | 452 ms |
354
+ | filter | 15 ms |
355
+ | groupBy ccy | 27 ms |
356
+ | groupBy ccy + exchange, with aggregations | 64 ms |
357
+ | switch aggregation sets | 37 ms |
358
+ | expand/collapse one group | 1.4 ms |
359
+ | expand all 56 groups, then collapse all | 329 ms |
360
+ | scroll, 100 range changes | 0.7 ms |
361
+ | 1000 ticks, sorted column | 8.4 ms |
362
+ | 1000 ticks, grouped, aggregated and expanded | 1.4 ms |
363
+ | 500 deletes + 500 inserts, sorted | 5.8 ms |
364
+
365
+ A 1M-row table fits comfortably in a browser tab, and data sources over it are cheap. Ticks,
366
+ churn, scrolling and expand/collapse stay in the low milliseconds. Sorting runs on the main
367
+ thread and takes a few hundred milliseconds, long enough to be noticeable when it repeats.
314
368
 
315
369
  ## Tests
316
370
 
@@ -323,3 +377,6 @@ provides `requestAnimationFrame` and `window`, and `test/happy-dom.ts` registers
323
377
  React test only.
324
378
 
325
379
  `test/EngineDataSource.test.ts` holds the conformance tests for the engine-backed data source.
380
+ `test/GroupedDataSource.test.ts` covers aggregations (every type, multi-level, live updates,
381
+ sorting by an aggregate) and group expand/collapse (by key and index, nested groups, state
382
+ across sort, updates and groupBy changes, subscriber notifications).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heswell/vuu-data-engine-local",
3
- "version": "4.2.4",
3
+ "version": "4.3.0",
4
4
  "description": "In-browser Vuu server (VuuModule, tables, EngineDataSource) built on @heswell/vuu-table and @heswell/vuu-viewport",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -28,17 +28,17 @@
28
28
  "dependencies": {
29
29
  "@heswell/module-admin": "^2.2.0",
30
30
  "@heswell/user-admin": "^1.0.2",
31
- "@heswell/vuu-table": "^1.0.3",
32
- "@heswell/vuu-viewport": "^1.1.6"
31
+ "@heswell/vuu-table": "^1.1.0",
32
+ "@heswell/vuu-viewport": "^1.2.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@vuu-ui/core": "^4.0.0-alpha.26",
36
- "@vuu-ui/vuu-data-types": "^4.0.0-alpha.26",
37
- "@vuu-ui/vuu-filter-parser": "^4.0.0-alpha.26",
38
- "@vuu-ui/vuu-filter-types": "^4.0.0-alpha.26",
39
- "@vuu-ui/vuu-protocol-types": "^4.0.0-alpha.26",
40
- "@vuu-ui/vuu-table-types": "^4.0.0-alpha.26",
41
- "@vuu-ui/vuu-utils": "^4.0.0-alpha.26",
35
+ "@vuu-ui/core": "^5.0.0-alpha.2",
36
+ "@vuu-ui/vuu-data-types": "^5.0.0-alpha.2",
37
+ "@vuu-ui/vuu-filter-parser": "^5.0.0-alpha.2",
38
+ "@vuu-ui/vuu-filter-types": "^5.0.0-alpha.2",
39
+ "@vuu-ui/vuu-protocol-types": "^5.0.0-alpha.2",
40
+ "@vuu-ui/vuu-table-types": "^5.0.0-alpha.2",
41
+ "@vuu-ui/vuu-utils": "^5.0.0-alpha.2",
42
42
  "react": "^19.2.3"
43
43
  },
44
44
  "sideEffects": [