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)) return s.accepts?.find(a => nodeType.outputs?.includes(a))
})) }))
console.log(definitions.map(d => Object.values(d?.inputs ?? {})))
console.log(definitions)
return definitions return definitions
} }

View File

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

View File

@@ -2,12 +2,11 @@ import { MemoryRuntimeExecutor } from "./runtime-executor";
import { RemoteNodeRegistry, IndexDBCache } from "@nodarium/registry"; import { RemoteNodeRegistry, IndexDBCache } from "@nodarium/registry";
import type { Graph } from "@nodarium/types"; import type { Graph } from "@nodarium/types";
import { createPerformanceStore } from "@nodarium/utils"; import { createPerformanceStore } from "@nodarium/utils";
import { MemoryRuntimeCache } from "./runtime-executor-cache";
const cache = new MemoryRuntimeCache();
const indexDbCache = new IndexDBCache("node-registry"); const indexDbCache = new IndexDBCache("node-registry");
const nodeRegistry = new RemoteNodeRegistry("", indexDbCache); const nodeRegistry = new RemoteNodeRegistry("", indexDbCache);
const executor = new MemoryRuntimeExecutor(nodeRegistry, cache);
const executor = new MemoryRuntimeExecutor(nodeRegistry);
const performanceStore = createPerformanceStore(); const performanceStore = createPerformanceStore();
executor.perf = performanceStore; executor.perf = performanceStore;

View File

@@ -82,6 +82,11 @@ export const AppSettingTypes = {
label: "Show Stem Lines", label: "Show Stem Lines",
value: false, value: false,
}, },
showGraphJson: {
type: "boolean",
label: "Show Graph Source",
value: false,
},
stressTest: { stressTest: {
title: "Stress Test", title: "Stress Test",
amount: { 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 { createPerformanceStore } from "@nodarium/utils";
import BenchmarkPanel from "$lib/sidebar/panels/BenchmarkPanel.svelte"; import BenchmarkPanel from "$lib/sidebar/panels/BenchmarkPanel.svelte";
import { debounceAsyncFunction } from "$lib/helpers"; import { debounceAsyncFunction } from "$lib/helpers";
import GraphSource from "$lib/sidebar/panels/GraphSource.svelte";
let performanceStore = createPerformanceStore(); let performanceStore = createPerformanceStore();
@@ -88,16 +89,13 @@
}); });
let runIndex = 0; let runIndex = 0;
const handleUpdate = debounceAsyncFunction(
async (g: Graph, s: Record<string, any> = graphSettings) => { async function update(g: Graph, s: Record<string, any> = graphSettings) {
runIndex++; runIndex++;
performanceStore.startRun(); performanceStore.startRun();
try { try {
let a = performance.now(); let a = performance.now();
const graphResult = await runtime.execute( const graphResult = await runtime.execute(g, s);
$state.snapshot(g),
$state.snapshot(s),
);
let b = performance.now(); let b = performance.now();
if (appSettings.value.debug.useWorker) { if (appSettings.value.debug.useWorker) {
@@ -119,8 +117,9 @@
} finally { } finally {
performanceStore.stopRun(); performanceStore.stopRun();
} }
}, }
);
const handleUpdate = debounceAsyncFunction(update);
$effect(() => { $effect(() => {
//@ts-ignore //@ts-ignore
@@ -220,6 +219,14 @@
<PerformanceViewer data={$performanceStore} /> <PerformanceViewer data={$performanceStore} />
{/if} {/if}
</Panel> </Panel>
<Panel
id="graph-source"
title="Graph Source"
hidden={!appSettings.value.debug.showGraphJson}
icon="i-tabler-code"
>
<GraphSource {graph} />
</Panel>
<Panel <Panel
id="benchmark" id="benchmark"
title="Benchmark" title="Benchmark"