effective-progress 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
  ## Install
25
25
 
26
26
  ```bash
27
- bun add effective-progress effect@^4.0.0-beta.100
27
+ bun add effective-progress effect@^4.0.0-rc.112
28
28
  ```
29
29
 
30
30
  ## Usage
@@ -270,6 +270,24 @@ const program = Progress.task(
270
270
 
271
271
  If a task does not provide `columns`, the renderer falls back to `Progress.Columns.defaults()`.
272
272
 
273
+ ## Performance benchmarks
274
+
275
+ Run `bun run bench` for isolated store-update and column-resolution measurements.
276
+ Each fixture uses three warmup rounds and nine measured rounds, reporting JSON with
277
+ raw samples, median/min/max time, throughput, and runtime information. Task setup,
278
+ correctness assertions, explicit flushes, and console output are outside the timed sections;
279
+ the benchmark does not render a terminal UI or add sleeps.
280
+
281
+ The store cases update one hot task in stores of 1, 100, and 1,000 tasks. Column cases
282
+ resolve 100 and 1,000 rows using defaults or distinct custom prepare functions. Every
283
+ round checks final counters or prepared/layout output and exits with an error on a mismatch.
284
+
285
+ To compare a change, run the same benchmark on both revisions with the same Bun
286
+ version and machine, without other CPU-heavy work. Alternate revision order across
287
+ multiple runs and compare medians and sample spread. These microbenchmarks measure
288
+ store/resolver work; use the existing `perf` script and performance examples separately
289
+ to investigate Ink rendering, logging, and end-to-end overhead.
290
+
273
291
  ## Effect compatibility
274
292
 
275
- This release targets Effect `4.0.0-beta.100` or newer compatible v4 prereleases. Effect v4 is still in beta, so its APIs may change between beta releases.
293
+ This release targets Effect `4.0.0-rc.112` or newer compatible v4 prereleases. Effect v4 is a release candidate, so its APIs may change before the stable release.
package/dist/index.mjs CHANGED
@@ -540,7 +540,7 @@ const makeProgressStoreRuntime = (publishQueue) => {
540
540
  };
541
541
  const makeProgressStore = Effect.gen(function* () {
542
542
  const runtime = makeProgressStoreRuntime(yield* Queue.sliding(1));
543
- yield* Effect.forkDetach(runtime.publisherLoop);
543
+ yield* Effect.forkScoped(runtime.publisherLoop);
544
544
  return runtime.store;
545
545
  });
546
546
  var ProgressStore = class ProgressStore extends Context.Service()("stromseng.dev/effective-progress/ProgressStore") {
@@ -1047,8 +1047,8 @@ const resolveColumnSizeValue = (value, prepared) => {
1047
1047
 
1048
1048
  //#endregion
1049
1049
  //#region src/services/renderer/column-resolver.ts
1050
- const NO_PREPARE = Symbol("no-prepare");
1051
- const getColumnsForRow = (row, columns) => columns.get(row.task.id) ?? defaults();
1050
+ const DEFAULT_COLUMNS = defaults();
1051
+ const getColumnsForRow = (row, columns) => columns.get(row.task.id) ?? DEFAULT_COLUMNS;
1052
1052
  const toCellInfo = (row) => row;
1053
1053
  const maxDefined = (values) => values.reduce((maxValue, value) => value === void 0 ? maxValue : Math.max(maxValue ?? Number.NEGATIVE_INFINITY, value), void 0);
1054
1054
  const resolvePreparedGroups = (defs, cellInfos) => {
@@ -1062,20 +1062,10 @@ const resolvePreparedGroups = (defs, cellInfos) => {
1062
1062
  if (rows) rows.push(cell);
1063
1063
  else groupedRows.set(key, [cell]);
1064
1064
  });
1065
- const groups = [{
1066
- key: NO_PREPARE,
1067
- prepared: void 0
1068
- }];
1069
- for (const [key, rows] of groupedRows) groups.push({
1070
- key,
1071
- prepared: key(rows)
1072
- });
1065
+ const groups = /* @__PURE__ */ new Map();
1066
+ for (const [key, rows] of groupedRows) groups.set(key, key(rows));
1073
1067
  return groups;
1074
1068
  };
1075
- const getPreparedFor = (def, groups) => {
1076
- if (!def?.prepare) return;
1077
- return groups.find((group) => group.key === def.prepare)?.prepared;
1078
- };
1079
1069
  const resolveColumns = (rows, columns) => {
1080
1070
  const columnsByRow = rows.map((row) => getColumnsForRow(row, columns));
1081
1071
  const cellInfos = rows.map(toCellInfo);
@@ -1085,7 +1075,7 @@ const resolveColumns = (rows, columns) => {
1085
1075
  const preparedGroups = resolvePreparedGroups(defsAtIndex, cellInfos);
1086
1076
  const entries = defsAtIndex.map((column) => column === void 0 ? void 0 : {
1087
1077
  column,
1088
- prepared: getPreparedFor(column, preparedGroups)
1078
+ prepared: column.prepare === void 0 ? void 0 : preparedGroups.get(column.prepare)
1089
1079
  });
1090
1080
  return {
1091
1081
  index,
@@ -1248,7 +1238,7 @@ const useProgressRenderView = (store) => {
1248
1238
  return {
1249
1239
  publication,
1250
1240
  renderSnapshot,
1251
- hasRunningTasks: renderSnapshot.rows.some((row) => row.task.status === "running")
1241
+ hasRunningTasks: renderSnapshot.hasRunningTasks
1252
1242
  };
1253
1243
  };
1254
1244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effective-progress",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Effect-first terminal progress bars with nested multibar support",
5
5
  "homepage": "https://github.com/stromseng/effective-progress#readme",
6
6
  "bugs": {
@@ -40,6 +40,7 @@
40
40
  "format": "oxfmt --write .",
41
41
  "format:check": "oxfmt --check .",
42
42
  "check": "bun run typecheck && bun run lint && bun run format:check && knip",
43
+ "bench": "bun examples/benchmarks.ts",
43
44
  "perf": "bun --cpu-prof --cpu-prof-md examples/performance.ts"
44
45
  },
45
46
  "dependencies": {
@@ -52,7 +53,7 @@
52
53
  "@effect/language-service": "^0.73.1",
53
54
  "@types/bun": "latest",
54
55
  "@types/react": "^19.2.14",
55
- "effect": "^4.0.0-beta.100",
56
+ "effect": "^4.0.0-rc.112",
56
57
  "knip": "^5.86.0",
57
58
  "oxfmt": "^0.32.0",
58
59
  "oxlint": "^1.47.0",
@@ -61,9 +62,9 @@
61
62
  "typescript": "^5"
62
63
  },
63
64
  "peerDependencies": {
64
- "effect": "^4.0.0-beta.100"
65
+ "effect": "^4.0.0-rc.112"
65
66
  },
66
67
  "engines": {
67
- "node": ">=20.12.0"
68
+ "node": ">=22"
68
69
  }
69
70
  }