Skip to content

Instantly share code, notes, and snippets.

@Nymphium
Last active May 7, 2020 17:33
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 Nymphium/1f624bf08b274af190786197dfe0f34d to your computer and use it in GitHub Desktop.
Save Nymphium/1f624bf08b274af190786197dfe0f34d to your computer and use it in GitHub Desktop.
environment
OS ArchLinux
Mem 16GB
CPU intel Core i7 8565U
$ time node hoge
hello
!
world
node hoge  3.87s user 0.26s system 120% cpu 3.422 total
async function f() {
const p = new Promise(resolve => setTimeout(() => {
console.log("hello");
resolve();
}, 2000));
for(let x = 0; x < 5000000; x++) {
setTimeout(() => {}, 10);
}
setTimeout(() => console.log("world"), 1000);
await p;
console.log("!");
}
f()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment