Forum Discussion

cwwoodall's avatar
cwwoodall
Member
2 months ago

Does HW throttle javascript execution?

I was having some timing issues and couldn't figure out how, so I did a basic test. I used a basic for loop to call a basic function with some basic calculations and based on console logs and timestamps, it seems HW is throttling execution? 

private testBasicLoop(): void {
    if (this.props.enableDebug) console.log(`[DamageableManager] === BASIC LOOP TEST ===`);
    for (let i = 0; i < 10; i++) {
      const timestamp = Date.now();
      // Just do some basic operations
      const pos = new hz.Vec3(i, i, i);
      const offset = new hz.Vec3(Math.random(), Math.random(), Math.random());
      const result = pos.add(offset);
      
      if (this.props.enableDebug) {
        console.log(`[${timestamp}] Basic operation ${i} completed`);
      }
    }
    if (this.props.enableDebug) console.log(`[DamageableManager] === END BASIC LOOP TEST ===`);
  }

 

1 Reply

  • Does this happen in preview/published mode? Drop a debug gizmo in to test.