Since hack is a single threaded language, what is the benefit of using a concurrent block?
concurrent {
await func_a;
await func_b;
}
My understanding is that one job is waiting until the other job is over.
Since hack is a single threaded language, what is the benefit of using a concurrent block?
concurrent {
await func_a;
await func_b;
}
My understanding is that one job is waiting until the other job is over.
Copyright © 2021 Jogjafile Inc.
Concurrent doesn't mean multithreading
The concurrent block will wait for all async operations (awaitables) in that block similarly to javascript
Promise.all(also single threaded).Without concurrent:
With concurrent:
It fits if you want to make multiple IO requests in parallel.
It doesn't fit if you want to run multiple CPU jobs.