| Yeah, Thread/sleep isn't quite what you want here: (time (let [c (chan), n 1000] (dotimes [i n] (go (Thread/sleep 50) (>! c i))) (dotimes [i n] (<!! c)))) "Elapsed time: 8412.25733 msecs" (defmacro gosleep [millis] `(<! (timeout ~millis))) (time (let [c (chan), n 1000] (dotimes [i n] (go (gosleep 50) (>! c i))) (dotimes [i n] (<!! c)))) "Elapsed time: 91.278469 msecs" ETA: for comparison, here's what happens if you actually make 1000 system threads: (time (let [c (chan) n 1000] (dotimes [i n] (thread (Thread/sleep 50) (>!! c i))) (dotimes [i n] (<!! c)))) "Elapsed time: 4183.669835 msecs" |