@camstack/addon-benchmark 0.1.33 → 0.2.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 (73) hide show
  1. package/dist/_stub.js +54314 -40070
  2. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-bQNWCtal.mjs +156 -0
  3. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.js-DSTkBuYy.mjs +25 -0
  4. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CICN6dKn.mjs +26 -0
  5. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-lv97RBhq.mjs +89 -0
  6. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-DtWmo0vJ.mjs +58 -0
  7. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-Bh7FS7ML.mjs +62 -0
  8. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-DHm30T13.mjs +70 -0
  9. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-SOU_VnTj.mjs +34 -0
  10. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_2_dom__loadShare__.js-DQaf3kYb.mjs +45 -0
  11. package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DUzuN6aS.mjs +34 -0
  12. package/dist/addon-benchmark.css +3 -1
  13. package/dist/hostInit-sayMKkNX.mjs +129 -0
  14. package/dist/index.js +105 -52
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +107 -63
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/remoteEntry.js +2 -5
  19. package/dist/remoteEntry.ssr.js +33 -0
  20. package/dist/rolldown-runtime-HEgqtunE.mjs +20 -0
  21. package/dist/virtualExposes-erbhyesj.mjs +27 -0
  22. package/dist/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-C6uSRkaU.mjs +2866 -0
  23. package/dist/virtual_mf-exposes-ssr___mfe_internal__addon_benchmark_page__remoteEntry_js-D9DseO5a.mjs +10 -0
  24. package/package.json +7 -7
  25. package/dist/@mf-types/compiled-types/benchmark-schemas.d.ts +0 -580
  26. package/dist/@mf-types/compiled-types/benchmark-schemas.d.ts.map +0 -1
  27. package/dist/@mf-types/compiled-types/components/NodeSelector.d.ts +0 -7
  28. package/dist/@mf-types/compiled-types/components/NodeSelector.d.ts.map +0 -1
  29. package/dist/@mf-types/compiled-types/page.d.ts +0 -4
  30. package/dist/@mf-types/compiled-types/page.d.ts.map +0 -1
  31. package/dist/@mf-types/compiled-types/tabs/AudioTab.d.ts +0 -6
  32. package/dist/@mf-types/compiled-types/tabs/AudioTab.d.ts.map +0 -1
  33. package/dist/@mf-types/compiled-types/tabs/DecoderTab.d.ts +0 -8
  34. package/dist/@mf-types/compiled-types/tabs/DecoderTab.d.ts.map +0 -1
  35. package/dist/@mf-types/compiled-types/tabs/HistoryTab.d.ts +0 -6
  36. package/dist/@mf-types/compiled-types/tabs/HistoryTab.d.ts.map +0 -1
  37. package/dist/@mf-types/compiled-types/tabs/ImageTab.d.ts +0 -6
  38. package/dist/@mf-types/compiled-types/tabs/ImageTab.d.ts.map +0 -1
  39. package/dist/@mf-types/compiled-types/tabs/PipelineTab.d.ts +0 -5
  40. package/dist/@mf-types/compiled-types/tabs/PipelineTab.d.ts.map +0 -1
  41. package/dist/@mf-types/compiled-types/tabs/WebRTCTab.d.ts +0 -5
  42. package/dist/@mf-types/compiled-types/tabs/WebRTCTab.d.ts.map +0 -1
  43. package/dist/@mf-types/compiled-types/webrtc/webrtc-probe.d.ts +0 -68
  44. package/dist/@mf-types/compiled-types/webrtc/webrtc-probe.d.ts.map +0 -1
  45. package/dist/ReactKonva-Cowc3qY6.mjs +0 -14906
  46. package/dist/__mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-lantnv8e.mjs +0 -12
  47. package/dist/__mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CPfBDuMJ.mjs +0 -29
  48. package/dist/__mfe_internal__addon_benchmark_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-BLZ56qK0.mjs +0 -104
  49. package/dist/__mfe_internal__addon_benchmark_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-BVQD7n0x.mjs +0 -85
  50. package/dist/__mfe_internal__addon_benchmark_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-BXYVnRIg.mjs +0 -62
  51. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.mjs-CemCcHeI.mjs +0 -89
  52. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.mjs_commonjs-proxy-D6ksjyzK.mjs +0 -29
  53. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-rG8Cwul7.mjs +0 -36
  54. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react_mf_2_dom__loadShare__.mjs-DJwYdRXA.mjs +0 -45
  55. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BbtFLGmB.mjs +0 -6
  56. package/dist/__mfe_internal__addon_benchmark_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DJYmMG8o.mjs +0 -34
  57. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-Bz1iK14J.mjs +0 -157
  58. package/dist/client-CB44E33z.mjs +0 -9836
  59. package/dist/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +0 -211
  60. package/dist/hostInit-C9s2hXe7.mjs +0 -168
  61. package/dist/index-BaKg996_.mjs +0 -1641
  62. package/dist/index-BcaueCG_.mjs +0 -52893
  63. package/dist/index-CWkKuNLr.mjs +0 -232
  64. package/dist/index-DUizOExi.mjs +0 -725
  65. package/dist/index-DtOI1aTU.mjs +0 -18504
  66. package/dist/index-DwKzY9Ja.mjs +0 -185
  67. package/dist/index-NHB4xixY.mjs +0 -435
  68. package/dist/index-jj6wOMLX.mjs +0 -2603
  69. package/dist/index-xncRG7-x.mjs +0 -2713
  70. package/dist/jsx-runtime-CVX781Ex.mjs +0 -55
  71. package/dist/schemas-B7L0qZtq.mjs +0 -3599
  72. package/dist/virtualExposes-pfue1WZv.mjs +0 -42
  73. package/dist/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-Cj6L7_80.mjs +0 -2974
package/dist/index.mjs CHANGED
@@ -8,12 +8,7 @@ var __export = (target, all) => {
8
8
  import { fileURLToPath } from "url";
9
9
  import * as path2 from "path";
10
10
  import * as fs2 from "fs";
11
- import {
12
- BaseAddon,
13
- addonPagesSourceCapability,
14
- parseJsonUnknown,
15
- errMsg
16
- } from "@camstack/types";
11
+ import { BaseAddon, addonPagesSourceCapability, parseJsonUnknown, errMsg } from "@camstack/types";
17
12
 
18
13
  // ../../node_modules/zod/v4/classic/external.js
19
14
  var external_exports = {};
@@ -14742,14 +14737,12 @@ var MultiCameraStressResultSchema = external_exports.object({
14742
14737
  });
14743
14738
 
14744
14739
  // src/benchmark-actions.ts
14745
- import {
14746
- customAction,
14747
- defineCustomActions,
14748
- PipelineRunResultBridge
14749
- } from "@camstack/types";
14740
+ import { customAction, defineCustomActions, PipelineRunResultBridge } from "@camstack/types";
14750
14741
  var benchmarkActions = defineCustomActions({
14751
14742
  // Pipeline tester
14752
- runPipelineTest: customAction(PipelineRunInputSchema, PipelineRunResultBridge, { kind: "mutation" }),
14743
+ runPipelineTest: customAction(PipelineRunInputSchema, PipelineRunResultBridge, {
14744
+ kind: "mutation"
14745
+ }),
14753
14746
  /**
14754
14747
  * Decode a JPEG once on the server and cache the resulting raw RGB
14755
14748
  * buffer keyed by a returned `frameId`. Subsequent `runPipelineTest`
@@ -14775,7 +14768,9 @@ var benchmarkActions = defineCustomActions({
14775
14768
  * `pipelineExecutor.runPipelineBatch` cap call. Returns N
14776
14769
  * `FrameResult`s plus aggregate timing.
14777
14770
  */
14778
- runPipelineBatchTest: customAction(PipelineRunBatchInputSchema, PipelineRunBatchResultSchema, { kind: "mutation" }),
14771
+ runPipelineBatchTest: customAction(PipelineRunBatchInputSchema, PipelineRunBatchResultSchema, {
14772
+ kind: "mutation"
14773
+ }),
14779
14774
  /**
14780
14775
  * Multi-camera stress tester — runs the full multi-camera workload
14781
14776
  * loop in-process (decode JPEG once, then N parallel "cameras" each
@@ -14783,7 +14778,11 @@ var benchmarkActions = defineCustomActions({
14783
14778
  * only aggregate detection-rate stats. Used to measure the pool's
14784
14779
  * true throughput ceiling without per-call tRPC overhead.
14785
14780
  */
14786
- runMultiCameraStressTest: customAction(MultiCameraStressInputSchema, MultiCameraStressResultSchema, { kind: "mutation" }),
14781
+ runMultiCameraStressTest: customAction(
14782
+ MultiCameraStressInputSchema,
14783
+ MultiCameraStressResultSchema,
14784
+ { kind: "mutation" }
14785
+ ),
14787
14786
  // History (shared across pipeline + decoder-perf entries)
14788
14787
  listBenchmarkHistory: customAction(external_exports.void(), external_exports.array(HistoryEntrySchema).readonly()),
14789
14788
  saveBenchmarkResult: customAction(
@@ -14801,18 +14800,14 @@ var benchmarkActions = defineCustomActions({
14801
14800
  external_exports.object({ success: external_exports.literal(true) }),
14802
14801
  { kind: "mutation" }
14803
14802
  ),
14804
- clearBenchmarkHistory: customAction(
14805
- external_exports.void(),
14806
- external_exports.object({ success: external_exports.literal(true) }),
14807
- { kind: "mutation" }
14808
- ),
14803
+ clearBenchmarkHistory: customAction(external_exports.void(), external_exports.object({ success: external_exports.literal(true) }), {
14804
+ kind: "mutation"
14805
+ }),
14809
14806
  // Decoder perf — fixture discovery + run control
14810
14807
  listDecoderFixtures: customAction(external_exports.void(), external_exports.array(DecoderFixtureSchema).readonly()),
14811
- runDecoderPerformanceTest: customAction(
14812
- DecoderPerfInputSchema,
14813
- DecoderPerfResultSchema,
14814
- { kind: "mutation" }
14815
- ),
14808
+ runDecoderPerformanceTest: customAction(DecoderPerfInputSchema, DecoderPerfResultSchema, {
14809
+ kind: "mutation"
14810
+ }),
14816
14811
  abortDecoderPerformanceTest: customAction(
14817
14812
  external_exports.object({ sessionId: external_exports.string() }),
14818
14813
  external_exports.object({ aborted: external_exports.boolean() }),
@@ -14829,18 +14824,20 @@ import { createEvent } from "@camstack/types";
14829
14824
  var CHUNK_SIZE = 4096;
14830
14825
  function emitProgress(eventBus, payload) {
14831
14826
  if (!eventBus) return;
14832
- eventBus.emit(createEvent(
14833
- "benchmark.progress",
14834
- { type: "benchmark", id: "decoder-perf" },
14835
- {
14836
- kind: payload.kind,
14837
- sessionId: payload.sessionId,
14838
- phase: payload.phase,
14839
- tSec: payload.tSec,
14840
- sample: payload.sample ? { ...payload.sample } : void 0,
14841
- message: payload.message
14842
- }
14843
- ));
14827
+ eventBus.emit(
14828
+ createEvent(
14829
+ "benchmark.progress",
14830
+ { type: "benchmark", id: "decoder-perf" },
14831
+ {
14832
+ kind: payload.kind,
14833
+ sessionId: payload.sessionId,
14834
+ phase: payload.phase,
14835
+ tSec: payload.tSec,
14836
+ sample: payload.sample ? { ...payload.sample } : void 0,
14837
+ message: payload.message
14838
+ }
14839
+ )
14840
+ );
14844
14841
  }
14845
14842
  function slope(xs, ys) {
14846
14843
  if (xs.length < 2) return 0;
@@ -14895,7 +14892,9 @@ async function destroySessions(api, handles, logger) {
14895
14892
  try {
14896
14893
  await api.decoder.destroySession.query({ sessionId: h.sessionId, nodeId: h.nodeId });
14897
14894
  } catch (err) {
14898
- logger.warn("destroySession failed", { meta: { sessionId: h.sessionId, error: err instanceof Error ? err.message : String(err) } });
14895
+ logger.warn("destroySession failed", {
14896
+ meta: { sessionId: h.sessionId, error: err instanceof Error ? err.message : String(err) }
14897
+ });
14899
14898
  }
14900
14899
  }
14901
14900
  }
@@ -14935,7 +14934,12 @@ async function runDecoderPerfTest(input, deps) {
14935
14934
  const sessionId = input.sessionId;
14936
14935
  const samples = [];
14937
14936
  const startWall = performance.now();
14938
- emitProgress(eventBus, { kind: "decoder-perf", sessionId, phase: "init", message: "initialising" });
14937
+ emitProgress(eventBus, {
14938
+ kind: "decoder-perf",
14939
+ sessionId,
14940
+ phase: "init",
14941
+ message: "initialising"
14942
+ });
14939
14943
  if (input.source.kind !== "sample") {
14940
14944
  const msg = "decoder perf: stream source not yet implemented \u2014 use a sample fixture";
14941
14945
  emitProgress(eventBus, { kind: "decoder-perf", sessionId, phase: "error", message: msg });
@@ -14966,9 +14970,13 @@ async function runDecoderPerfTest(input, deps) {
14966
14970
  const instances = await api.metricsProvider.listAddonInstances.query();
14967
14971
  const workerInstances = instances.filter((i) => i.role === "worker");
14968
14972
  if (workerInstances.length === 0) {
14969
- logger.info("decoder perf: no isolated worker detected \u2014 hub-local measurement (process.memoryUsage) mixes decoder + hub workload");
14973
+ logger.info(
14974
+ "decoder perf: no isolated worker detected \u2014 hub-local measurement (process.memoryUsage) mixes decoder + hub workload"
14975
+ );
14970
14976
  } else {
14971
- logger.info("decoder perf: worker instances visible", { meta: { workers: workerInstances.map((w) => w.addonId) } });
14977
+ logger.info("decoder perf: worker instances visible", {
14978
+ meta: { workers: workerInstances.map((w) => w.addonId) }
14979
+ });
14972
14980
  }
14973
14981
  } catch {
14974
14982
  }
@@ -14977,7 +14985,12 @@ async function runDecoderPerfTest(input, deps) {
14977
14985
  handles = await createSessions(api, input, codec2);
14978
14986
  } catch (err) {
14979
14987
  const msg = err instanceof Error ? err.message : String(err);
14980
- emitProgress(eventBus, { kind: "decoder-perf", sessionId, phase: "error", message: `createSession failed: ${msg}` });
14988
+ emitProgress(eventBus, {
14989
+ kind: "decoder-perf",
14990
+ sessionId,
14991
+ phase: "error",
14992
+ message: `createSession failed: ${msg}`
14993
+ });
14981
14994
  return {
14982
14995
  sessionId,
14983
14996
  verdict: "error",
@@ -14999,7 +15012,13 @@ async function runDecoderPerfTest(input, deps) {
14999
15012
  let nextFeedAt = feedTickerStart;
15000
15013
  let nextSampleAt = feedTickerStart + warmupMs;
15001
15014
  let aborted2 = false;
15002
- emitProgress(eventBus, { kind: "decoder-perf", sessionId, phase: "warmup", tSec: 0, message: `warming up ${input.warmupSec}s` });
15015
+ emitProgress(eventBus, {
15016
+ kind: "decoder-perf",
15017
+ sessionId,
15018
+ phase: "warmup",
15019
+ tSec: 0,
15020
+ message: `warming up ${input.warmupSec}s`
15021
+ });
15003
15022
  const loopUntil = feedTickerStart + warmupMs + durationMs;
15004
15023
  while (performance.now() < loopUntil) {
15005
15024
  if (abortFlag.aborted) {
@@ -15014,7 +15033,12 @@ async function runDecoderPerfTest(input, deps) {
15014
15033
  try {
15015
15034
  await pushChunk(api, h, fixture);
15016
15035
  } catch (err) {
15017
- logger.warn("pushPacket failed", { meta: { sessionId: h.sessionId, error: err instanceof Error ? err.message : String(err) } });
15036
+ logger.warn("pushPacket failed", {
15037
+ meta: {
15038
+ sessionId: h.sessionId,
15039
+ error: err instanceof Error ? err.message : String(err)
15040
+ }
15041
+ });
15018
15042
  }
15019
15043
  }
15020
15044
  nextFeedAt += frameIntervalMs;
@@ -15075,7 +15099,11 @@ async function runDecoderPerfTest(input, deps) {
15075
15099
  verdict,
15076
15100
  aborted: aborted2,
15077
15101
  samples,
15078
- slopes: { rssMBMin: rssSlopeMBMin, heapMBMin: heapSlopeMBMin, externalMBMin: externalSlopeMBMin },
15102
+ slopes: {
15103
+ rssMBMin: rssSlopeMBMin,
15104
+ heapMBMin: heapSlopeMBMin,
15105
+ externalMBMin: externalSlopeMBMin
15106
+ },
15079
15107
  totals: { wallSec, framesEmitted, fpsPerCamera, cpuAvgPct, droppedFrames },
15080
15108
  config: input
15081
15109
  };
@@ -15086,9 +15114,21 @@ var KEY_BENCHMARK_HISTORY = "benchmarkHistory";
15086
15114
  var MAX_HISTORY_ENTRIES = 100;
15087
15115
  var HistoryArraySchema = external_exports.array(HistoryEntrySchema);
15088
15116
  var FIXTURE_META = {
15089
- "camera-sim-360p.h264": { codec: "h264", resolutionLabel: "360p", description: "Synthetic 360p H.264 \u2014 light workload" },
15090
- "camera-sim-1080p.h264": { codec: "h264", resolutionLabel: "1080p", description: "Synthetic 1080p H.264 \u2014 production-like" },
15091
- "camera-sim-1440p-h265.hevc": { codec: "h265", resolutionLabel: "1440p", description: "Synthetic 1440p H.265 \u2014 hardware decode stress" }
15117
+ "camera-sim-360p.h264": {
15118
+ codec: "h264",
15119
+ resolutionLabel: "360p",
15120
+ description: "Synthetic 360p H.264 \u2014 light workload"
15121
+ },
15122
+ "camera-sim-1080p.h264": {
15123
+ codec: "h264",
15124
+ resolutionLabel: "1080p",
15125
+ description: "Synthetic 1080p H.264 \u2014 production-like"
15126
+ },
15127
+ "camera-sim-1440p-h265.hevc": {
15128
+ codec: "h265",
15129
+ resolutionLabel: "1440p",
15130
+ description: "Synthetic 1440p H.265 \u2014 hardware decode stress"
15131
+ }
15092
15132
  };
15093
15133
  function resolveFixturesDir() {
15094
15134
  const here = fileURLToPath(import.meta.url);
@@ -15210,7 +15250,8 @@ var BenchmarkAddon = class extends BaseAddon {
15210
15250
  }
15211
15251
  });
15212
15252
  const cached2 = frameId ? this.frameCache.get(frameId) : void 0;
15213
- if (frameId && !cached2) throw new Error(`runPipelineTest: frameId ${frameId} not in cache (expired or never cached)`);
15253
+ if (frameId && !cached2)
15254
+ throw new Error(`runPipelineTest: frameId ${frameId} not in cache (expired or never cached)`);
15214
15255
  const cachedImage = cached2 ? new Uint8Array(cached2.jpeg) : void 0;
15215
15256
  const image = cachedImage ?? (imageBase64 ? new Uint8Array(Buffer.from(imageBase64, "base64")) : void 0);
15216
15257
  const stepsToRun = steps.length > 0 ? [...steps] : await (async () => {
@@ -15388,23 +15429,26 @@ var BenchmarkAddon = class extends BaseAddon {
15388
15429
  }
15389
15430
  };
15390
15431
  const start = Date.now();
15391
- const cameraTasks = Array.from({ length: simulatedCameras }, (_, camIdx) => (async () => {
15392
- for (let i = 0; i < batchesPerCamera; i++) {
15393
- const dispatches = [
15394
- dispatchOne(batchedFrames, true, `c${camIdx}-r${i}-b`)
15395
- ];
15396
- for (let j = 0; j < extraSinglesPerRound; j++) {
15397
- dispatches.push(dispatchOne(singleFrames, false, `c${camIdx}-r${i}-s${j}`));
15398
- }
15399
- await Promise.all(dispatches);
15400
- countedDetections += batchSize;
15401
- totalCalls += 1 + extraSinglesPerRound;
15402
- totalFrames += batchSize + extraSinglesPerRound;
15403
- }
15404
- })());
15432
+ const cameraTasks = Array.from(
15433
+ { length: simulatedCameras },
15434
+ (_, camIdx) => (async () => {
15435
+ for (let i = 0; i < batchesPerCamera; i++) {
15436
+ const dispatches = [
15437
+ dispatchOne(batchedFrames, true, `c${camIdx}-r${i}-b`)
15438
+ ];
15439
+ for (let j = 0; j < extraSinglesPerRound; j++) {
15440
+ dispatches.push(dispatchOne(singleFrames, false, `c${camIdx}-r${i}-s${j}`));
15441
+ }
15442
+ await Promise.all(dispatches);
15443
+ countedDetections += batchSize;
15444
+ totalCalls += 1 + extraSinglesPerRound;
15445
+ totalFrames += batchSize + extraSinglesPerRound;
15446
+ }
15447
+ })()
15448
+ );
15405
15449
  await Promise.all(cameraTasks);
15406
15450
  const totalMs = Date.now() - start;
15407
- const sortedCall = [...callMsList].sort((a, b) => a - b);
15451
+ const sortedCall = [...callMsList].toSorted((a, b) => a - b);
15408
15452
  const pct = (xs, p) => {
15409
15453
  if (xs.length === 0) return 0;
15410
15454
  const idx = Math.min(xs.length - 1, Math.floor(xs.length * p));