Sorry, but... You should to use promise.all in the first approach also, to can compare with the second approach:
//const num1 = await func1(); //const num2 = await func2(); //const num3 = await func3(); //const num4 = await func4(); Promise.all([func1(), func2(), func3(), func4()]).then(([num1, num2, num3, num4]) => ...)
and then, you'll have the same 4 seconds to run.
Awesome idea about small chunks with IIFE.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sorry, but... You should to use promise.all in the first approach also, to can compare with the second approach:
//const num1 = await func1();
//const num2 = await func2();
//const num3 = await func3();
//const num4 = await func4();
Promise.all([func1(), func2(), func3(), func4()]).then(([num1, num2, num3, num4]) => ...)
and then, you'll have the same 4 seconds to run.
Awesome idea about small chunks with IIFE.