Last active
February 11, 2022 09:07
-
-
Save ujiro99/da273755d5e3381112e71547f218bb78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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