Skip to content

Commit

Permalink
use Matter.Runner in test worker
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Dec 7, 2021
1 parent a30707f commit 2581595
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/ExampleWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const runExample = options => {

const Examples = requireUncached('../examples/index');
const example = Examples[options.name]();

const engine = example.engine;
const runner = example.runner;

runner.delta = 1000 / 60;
runner.isFixed = true;

let totalMemory = 0;
let totalDuration = 0;
Expand All @@ -24,8 +29,8 @@ const runExample = options => {
for (let i = 0; i < options.updates; i += 1) {
const startTime = process.hrtime();
totalMemory += process.memoryUsage().heapUsed;
Matter.Engine.update(engine, 1000 / 60);

Matter.Runner.tick(runner, engine, i * runner.delta);

const duration = process.hrtime(startTime);
totalDuration += duration[0] * 1e9 + duration[1];
Expand Down

0 comments on commit 2581595

Please sign in to comment.