Testing of JS async/await
loop performance with for loop await vs map await.
Since for loop await
is a common mistake that JS developers makes, causes major performance issues without understanding the concept of parallel execution which can be done with Promise.all()
.
Can copy all this and execute to clone & install
git clone https://github.com/ChrisLegaxy/js-async-await-parallel-execution.git \
&& cd js-async-await-parallel-execution \
&& yarn
To run tests, run the following command
yarn test
Execution | Time | Description |
---|---|---|
BAD_AWAIT_LOOP |
4.006s |
MOCK TEST |
GOOD_AWAIT_LOOP |
1.001s |
MOCK TEST |
BAD_AWAIT_LOOP |
686.375ms |
REAL FETCH TEST |
GOOD_AWAIT_LOOP |
213.2ms |
REAL FETCH TEST |
Chris Legaxy/Chris Van
Contact: chris.legaxy@gmail.com | chrisvan.vshmr@gmail.com
Website: https://chrisvan.netlify.app