Open b4rtaz opened 1 year ago
This commit increases the frame loop performance by 15-20%. How I tested it? I've turned on CPU throttling 6x in Chrome and I've run the below code.
const results = new Array(30); let pos = 0; function onAnimationFrame() { const start = Date.now(); nes.frame(); const end = Date.now(); results[pos] = end - start; pos = (pos + 1) % results.length; if (pos === 0) { const avg = results.reduce((a, b) => a + b, 0) / results.length; console.log(avg); } // ... }
This improvement is felt well on slow phones.
Before my change:
After my change:
This commit increases the frame loop performance by 15-20%. How I tested it? I've turned on CPU throttling 6x in Chrome and I've run the below code.
This improvement is felt well on slow phones.
Results
Before my change:
After my change: