From 7aa579f9ab4a038442eca56ec644705191f726ce Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 30 Jan 2022 13:25:28 -0500 Subject: [PATCH] show max render time in debug stats --- notes.md | 1 + src/moto/space.js | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/notes.md b/notes.md index 3cd46dbc..2158910d 100644 --- a/notes.md +++ b/notes.md @@ -102,6 +102,7 @@ * `F` gcode output option as zip for multiple or flip ops or tool change * `F` maintain several part orientations + op chains in a single profile +* `P` decrease cutting speed when entire tool is engaged (start of roughing) * `P` port arc code from FDM export to CAM export * `P` common part pre-analyze to speed up 'slice' and improve shadow (overhangs) * `P` redo all path route / planning in prepare to account for terrain before camOut diff --git a/src/moto/space.js b/src/moto/space.js index 1a63a1d5..95e5d525 100644 --- a/src/moto/space.js +++ b/src/moto/space.js @@ -1285,8 +1285,7 @@ let animates = 0; let rateStart = Date.now(); - let renders = 0; - let renderSum = 0; + let renders = []; let renderStart; function animate() { @@ -1297,17 +1296,15 @@ fps = 1000 * animates / delta; animates = 0; rateStart = now; - renderTime = renders ? renderSum / renders : 0; - renders = 0; - renderSum = 0; + renderTime = Math.max(0, ...renders); + renders.length = 0; } requestAnimationFrame(animate); if (docVisible && !freeze && Date.now() - lastAction < 1500) { renderStart = Date.now(); renderer.render(SCENE, camera); - renderSum += Date.now() - renderStart; - renders++; + renders.push(Date.now() - renderStart); } else { fps = 0; }