basic state switching from loading to running to editing

This commit is contained in:
2025-02-08 01:16:09 -07:00
parent 623a324625
commit 791ba42ceb
21 changed files with 769 additions and 187 deletions

View File

@@ -1,10 +1,16 @@
import {
getContextItem,
setContextItem,
setDefaultContext,
withContext,
} from "@lib/context.ts"; // adjust path as needed
} from "../lib/context.ts"; // adjust path as needed
import { testPerformance } from "./bench.ts";
/**
* Benchmarks the performance of setting and getting context items.
* All context transactions should run 10000 times within the 60 FPS frame time.
* getContextItem should run 100000 times within the 240 FPS frame time to ensure adequate performance.
*/
Deno.test("Context Benchmark", () => {
console.log("Context Benchmark - run within frame time");
testPerformance(
@@ -32,4 +38,12 @@ Deno.test("Context Benchmark", () => {
100000,
240,
);
testPerformance(
() => {
setContextItem("a", 1);
},
10000,
60,
);
});