Created
June 6, 2019 22:58
-
-
Save arturovt/591a4960e529a0f6ec10b17a55732b2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const t0 = performance.now(); | |
for (let i = 0; i < 1e9; i++) {} | |
const t1 = performance.now(); | |
console.log(`"for" loop took ${t1 - t0}ms`); | |
setTimeout(() => { | |
const t0setTimeout = performance.now(); | |
for (let i = 0; i < 1e9; i++) {} | |
const t1setTimeout = performance.now(); | |
console.log(`"for" loop inside "setTimeout" took ${t1setTimeout - t0setTimeout}ms`); | |
}); | |
setTimeout(() => { | |
console.log('second "setTimeout" callback'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment