Skip to content

Commit

Permalink
simulator performance debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jodi Giordano committed Oct 25, 2024
1 parent 2933eee commit 3a92f02
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/simulator/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export async function loadSimulation(
options: { linkIndexToDebug?: number } = {},
): Promise<void> {
return new Promise((resolve, reject) => {
const startTime = performance.now();

worker.onCodeLoaded(() => {
worker
.sendOperation({
Expand All @@ -56,6 +58,8 @@ export async function loadSimulation(
// Set the new simulation in the state.
state.simulator = new SystemSimulator(data.simulator as any);

console.debug("loadSimulation", performance.now() - startTime, "ms");

drawSimulation();

state.simulatorInitialized = true;
Expand All @@ -82,6 +86,8 @@ export async function loadSimulation(
//

export function drawSimulation(): void {
const startTime = performance.now();

// Draw the new simulaton.
container.removeChildren();

Expand All @@ -91,6 +97,8 @@ export function drawSimulation(): void {
}

tick();

console.debug("loadSimulation", performance.now() - startTime, "ms");
}

// Container to display simulation objects.
Expand Down

0 comments on commit 3a92f02

Please sign in to comment.