Skip to content

Instantly share code, notes, and snippets.

@almeidx
Last active November 17, 2022 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almeidx/f175de7582ac83e9b8051b95e018f321 to your computer and use it in GitHub Desktop.
Save almeidx/f175de7582ac83e9b8051b95e018f321 to your computer and use it in GitHub Desktop.
Show the FPS of a window
let before = Date.now(), fps = 0, now;
requestAnimationFrame(function loop() {
now = Date.now();
fps = Math.round(1000 / (now - before));
before = now;
requestAnimationFrame(loop);
console.log('FPS:', fps);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment