chore: some updates
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m58s

This commit is contained in:
Max Richter
2025-12-01 18:29:47 +01:00
parent 1ea544e765
commit 7e51cc5ea1
6 changed files with 65 additions and 37 deletions

View File

@@ -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
}

View File

@@ -64,7 +64,7 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
constructor(
private registry: NodeRegistry,
private cache?: SyncCache<Int32Array>,
// private cache?: SyncCache<Int32Array>,
) { }
private async getNodeDefinitions(graph: Graph) {

View File

@@ -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;

View File

@@ -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: {

View File

@@ -0,0 +1,20 @@
<script lang="ts">
import type { Graph } from "$lib/types";
const { graph }: { graph: Graph } = $props();
function convert(g: Graph): string {
return JSON.stringify(
{
...g,
nodes: g.nodes.map((n: any) => ({ ...n, tmp: undefined })),
},
null,
2,
);
}
</script>
<pre>
{convert(graph)}
</pre>

View File

@@ -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<string, any> = 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<string, any> = 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 @@
<PerformanceViewer data={$performanceStore} />
{/if}
</Panel>
<Panel
id="graph-source"
title="Graph Source"
hidden={!appSettings.value.debug.showGraphJson}
icon="i-tabler-code"
>
<GraphSource {graph} />
</Panel>
<Panel
id="benchmark"
title="Benchmark"