fix: [SUP-1093] Replaced manual pMap
with actual pMap
#4604
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
A while back we introduced some pseudo-parallelization (to the extend Node allows) of promises when sending requests to our backend. The solution sped up things a bit, but the Promise-chunk would wait until the slowest promise had finished before starting a new batch.
pMap
accounts for this problem. The performance increase will not be that significant for smaller chunks of requests, but for bigger ones the lack of holes in the chain of unbroken ought to speed things up a bit.This change (like the one before) comes on the back of another customer support ticket, where scanning a large project takes over an hour.
The bottlenecks are numerous, but one of the biggest, as far as I have been able to identify, reveals itself around the requests to vulndb.
Performance comparisons
Comparing the performance running locally on an M1 Macbook Pro, against Snyk CLI v.
1.1159.0
.time snyk test --yarn-workspaces --detection-depth=3
Still quite a way to go to get this down to a few minutes, but I guess it's a start.