-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map() using @async #14515
Comments
Since it's <15 lines of code, does it need to be added to Base? |
@tkelman could you please tell me what's the minimum number of LOC that a PR should have in order to be considered into Base? |
It's not strictly a matter of lines of code, but code should really only be added to base if it's worth making all other code that's written in the language effectively depend on it. Or if it requires changes to the C runtime. That's a pretty high bar and things that are pure julia, or wrapping optional libraries, should be moving out of base over time. Unless there are other places currently in base that are doing exactly this and could be refactored for brevity if we choose to assign an exported name to async map, I don't think it would be widely used enough to absolutely need to be here (along with tests, documentation, and indefinite maintenance going forward). A small AsyncUtils package might be worth separating out, to potentially prove me wrong here. |
FWIW, I've posted some map() refactoring experiments here: https://github.com/samoconnor/AsyncMap.jl Related: |
Progress... (See https://github.com/samoconnor/AsyncMap.jl/commit/292e6bb11ee27cbc8f0e1c5d1702d503fa14453b)
e.g, three stage processing pipeline with input from infinite iterator: for r in imap(format, imap(analyse, imap(normalise, sqs_messages(queue); max=10)))
println(r)
end This will read up to 10 messages from the queue in parallel. |
Closing in favour of #14843 |
Below is the
amap()
function from http://github.com/samoconnor/AWSLambda.jlIt is not trying to be like
pmap()
(which deals with dispatching jobs to multiple compute nodes).It is just trying to be like
map()
but with@async
invocation off()
.This is a huge performance win any time
f()
touches network or disk or IPC or anything that might block.Should I submit a pull request to add this to
multi.jl
?abstractarray.jl
?In the following example,
amap()
opens 100 parallel network connections to execute 100 parallel calls to an AWS Lambda function.The text was updated successfully, but these errors were encountered: