Performance of Promise.all and for-await-of
Is asynchronous iteration (for-await-of loop) faster than using Promise.all?
No. Both the loop and Promise.all will finish when the last promise resolves, which will be roughly at the same time. If the last promise that resolves is the first promise in the array, then Promise.all finishes immeadiately while the loop still has to iterate the other elements which might cause a small overhead but that should not matter. The only situation were it really matters is:
If one of the promises gets rejected, Promise.all exits immeadiately, while the loop has to reach that promise.
I'm wondering if asynchronous iteration starts looping before all the pages are finished fetching.
Yes you could get the first results a bit earlier, but all results will be available at the same time. Using the for loop would make sense if you want to show the data to the user, as he can start reading while the rest is still fetching, if you however want to accumulate the data it makes sense to await them all as it simplifies the iteration logic.