Each go block is executed via thread pool. On a channel side, producers and 
consumers are also decoupled.
Such decoupling costs around 10-20 us per async operation. For the cases 
when your async
values are immediately available (e.g. from cache), or when you designed an 
async
API just because your operations may block for a long but not necessary do, 
those are huge numbers.

For example, I recently worked on a dependency injection 
container<https://github.com/dar-clojure/core> which 
supports async computations.
Asynchrony in one place means that all you API will be async everywhere. 
Natural way to go with implementation is to just
wrap everything in a go block. However, after doing that I found that 
container became 50 times slower. 5 us overhead for a
typical task turned into 250 us.

As a solution I forked <https://github.com/dar-clojure/async> core.async 
and replaced channels with lightweight promises and removed thread pool 
dispatch from
everywhere. Now async container implementation is only 5 times slower than 
its sync version, which is probably acceptable.

I'd like to hear what others think about this issue, especially members of 
the core team. 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to