Recently I was answering an @async
related question, and I remembered a documentation warning against @async
usage. After checking that out, it was still there:
It is strongly encouraged to favor
Threads.@spawn
over@async
always even when no parallelism is required especially in publicly distributed libraries. This is because a use of@async
disables the migration of the parent task across worker threads in the current implementation of Julia. Thus, seemingly innocent use of@async
in a library function can have a large impact on the performance of very different parts of user applications.
However, when looking, for example, at the Channels we see @async
is being used when instructing how people should use Channels.
So, either the warning is outdated, or the usage of @async
in other places of the documentation is somehow problematic (I don’t think it is fair to have people go and check if using @async
is good practice - since it is already used in the documentation as a proper way to do things - in this case Channels).
So, which one should we change?