Skip to content

Instantly share code, notes, and snippets.

@ujiro99
Last active February 11, 2022 09:07
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 ujiro99/da273755d5e3381112e71547f218bb78 to your computer and use it in GitHub Desktop.
Save ujiro99/da273755d5e3381112e71547f218bb78 to your computer and use it in GitHub Desktop.
let i = 0
const t = Date.now() + 5000
function raf() {
requestAnimationFrame(() => {
if(Date.now() < t){
i++
// console.log(i) // console.log is very heavy!
raf()
}else{
console.log('Frame rate is: %f fps', i / 5)
}
})
}
raf()
console.log('Testing frame rate...')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment