From 7e51cc5ea1562590202220976139a188d83b0c3b Mon Sep 17 00:00:00 2001 From: Max Richter Date: Mon, 1 Dec 2025 18:29:47 +0100 Subject: [PATCH] chore: some updates --- .../graph-interface/graph-manager.svelte.ts | 3 - app/src/lib/runtime/runtime-executor.ts | 2 +- .../worker-runtime-executor-backend.ts | 5 +- app/src/lib/settings/app-settings.svelte.ts | 5 ++ app/src/lib/sidebar/panels/GraphSource.svelte | 20 ++++++ app/src/routes/+page.svelte | 67 ++++++++++--------- 6 files changed, 65 insertions(+), 37 deletions(-) create mode 100644 app/src/lib/sidebar/panels/GraphSource.svelte diff --git a/app/src/lib/graph-interface/graph-manager.svelte.ts b/app/src/lib/graph-interface/graph-manager.svelte.ts index 9702cf0..5efee7c 100644 --- a/app/src/lib/graph-interface/graph-manager.svelte.ts +++ b/app/src/lib/graph-interface/graph-manager.svelte.ts @@ -610,9 +610,6 @@ export class GraphManager extends EventEmitter<{ return s.accepts?.find(a => nodeType.outputs?.includes(a)) })) - console.log(definitions.map(d => Object.values(d?.inputs ?? {}))) - console.log(definitions) - return definitions } diff --git a/app/src/lib/runtime/runtime-executor.ts b/app/src/lib/runtime/runtime-executor.ts index a2538bc..2c425d3 100644 --- a/app/src/lib/runtime/runtime-executor.ts +++ b/app/src/lib/runtime/runtime-executor.ts @@ -64,7 +64,7 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor { constructor( private registry: NodeRegistry, - private cache?: SyncCache, + // private cache?: SyncCache, ) { } private async getNodeDefinitions(graph: Graph) { diff --git a/app/src/lib/runtime/worker-runtime-executor-backend.ts b/app/src/lib/runtime/worker-runtime-executor-backend.ts index 1943c48..97478b4 100644 --- a/app/src/lib/runtime/worker-runtime-executor-backend.ts +++ b/app/src/lib/runtime/worker-runtime-executor-backend.ts @@ -2,12 +2,11 @@ import { MemoryRuntimeExecutor } from "./runtime-executor"; import { RemoteNodeRegistry, IndexDBCache } from "@nodarium/registry"; import type { Graph } from "@nodarium/types"; import { createPerformanceStore } from "@nodarium/utils"; -import { MemoryRuntimeCache } from "./runtime-executor-cache"; -const cache = new MemoryRuntimeCache(); const indexDbCache = new IndexDBCache("node-registry"); const nodeRegistry = new RemoteNodeRegistry("", indexDbCache); -const executor = new MemoryRuntimeExecutor(nodeRegistry, cache); + +const executor = new MemoryRuntimeExecutor(nodeRegistry); const performanceStore = createPerformanceStore(); executor.perf = performanceStore; diff --git a/app/src/lib/settings/app-settings.svelte.ts b/app/src/lib/settings/app-settings.svelte.ts index 92b3a3d..69856d5 100644 --- a/app/src/lib/settings/app-settings.svelte.ts +++ b/app/src/lib/settings/app-settings.svelte.ts @@ -82,6 +82,11 @@ export const AppSettingTypes = { label: "Show Stem Lines", value: false, }, + showGraphJson: { + type: "boolean", + label: "Show Graph Source", + value: false, + }, stressTest: { title: "Stress Test", amount: { diff --git a/app/src/lib/sidebar/panels/GraphSource.svelte b/app/src/lib/sidebar/panels/GraphSource.svelte new file mode 100644 index 0000000..37b3552 --- /dev/null +++ b/app/src/lib/sidebar/panels/GraphSource.svelte @@ -0,0 +1,20 @@ + + +
+  {convert(graph)}
+
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte index 9dc2e38..b20aeb6 100644 --- a/app/src/routes/+page.svelte +++ b/app/src/routes/+page.svelte @@ -27,6 +27,7 @@ import { createPerformanceStore } from "@nodarium/utils"; import BenchmarkPanel from "$lib/sidebar/panels/BenchmarkPanel.svelte"; import { debounceAsyncFunction } from "$lib/helpers"; + import GraphSource from "$lib/sidebar/panels/GraphSource.svelte"; let performanceStore = createPerformanceStore(); @@ -88,39 +89,37 @@ }); let runIndex = 0; - const handleUpdate = debounceAsyncFunction( - async (g: Graph, s: Record = graphSettings) => { - runIndex++; - performanceStore.startRun(); - try { - let a = performance.now(); - const graphResult = await runtime.execute( - $state.snapshot(g), - $state.snapshot(s), - ); - let b = performance.now(); - if (appSettings.value.debug.useWorker) { - let perfData = await runtime.getPerformanceData(); - let lastRun = perfData?.at(-1); - if (lastRun?.total) { - lastRun.runtime = lastRun.total; - delete lastRun.total; - performanceStore.mergeData(lastRun); - performanceStore.addPoint( - "worker-transfer", - b - a - lastRun.runtime[0], - ); - } + async function update(g: Graph, s: Record = graphSettings) { + runIndex++; + performanceStore.startRun(); + try { + let a = performance.now(); + const graphResult = await runtime.execute(g, s); + let b = performance.now(); + + if (appSettings.value.debug.useWorker) { + let perfData = await runtime.getPerformanceData(); + let lastRun = perfData?.at(-1); + if (lastRun?.total) { + lastRun.runtime = lastRun.total; + delete lastRun.total; + performanceStore.mergeData(lastRun); + performanceStore.addPoint( + "worker-transfer", + b - a - lastRun.runtime[0], + ); } - viewerComponent?.update(graphResult); - } catch (error) { - console.log("errors", error); - } finally { - performanceStore.stopRun(); } - }, - ); + viewerComponent?.update(graphResult); + } catch (error) { + console.log("errors", error); + } finally { + performanceStore.stopRun(); + } + } + + const handleUpdate = debounceAsyncFunction(update); $effect(() => { //@ts-ignore @@ -220,6 +219,14 @@ {/if} +