speed up ns1

This commit is contained in:
Olivier Gagnon
2021-11-05 14:32:21 -04:00
parent 362d2eb51d
commit d83650c3bc
12 changed files with 79 additions and 71 deletions
+8 -1
View File
@@ -266,7 +266,14 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<WorkerScript
return reject(workerScript);
}
if (interpreter.step()) {
let more = true;
let i = 0;
while (i < 3 && more) {
more = more && interpreter.step();
i++;
}
if (more) {
setTimeout(runInterpreter, Settings.CodeInstructionRunTime);
} else {
resolve(workerScript);