You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might clarify Readme.md examples if the difference between two kinds of thunks would be made clearer. Currently the thunks are introduced as trailing kind:
but functions from thunkify start the work already on the leading edge:
functionread(...args){// start work, save result laterreturnfunctionthunk(cb){// cb(err, result) or when result ready}}
This difference helps to understand when work can start concurrently (in the event loop sense) even before yielding.
Currently the frontpage examples mix both styles, confusing where the concurrency comes in each case. And the example with "3 concurrent requests at a time" and "9 concurrent requests" won't do what it says, because there are those sequential yields in the *results() generator, whatever style the thunks are.
The text was updated successfully, but these errors were encountered:
It think this is an implementation detail in thunkify, a thunk could be expressed the same, but in the case of thunkify, it's more like an optimization, in some cases by the time the generator calls .next() the asynchronous function may be done.
It might clarify
Readme.md
examples if the difference between two kinds of thunks would be made clearer. Currently the thunks are introduced as trailing kind:but functions from
thunkify
start the work already on the leading edge:This difference helps to understand when work can start concurrently (in the event loop sense) even before yielding.
Currently the frontpage examples mix both styles, confusing where the concurrency comes in each case. And the example with "3 concurrent requests at a time" and "9 concurrent requests" won't do what it says, because there are those sequential yields in the
*results()
generator, whatever style the thunks are.The text was updated successfully, but these errors were encountered: