guys I cant believe this <https://www.youtube.com/...
# coroutines
m
guys I cant believe this

https://www.youtube.com/watch?v=X1RVYt2QKQE&amp;feature=youtu.be&amp;t=36m54s

how can they executes 100000 sleeps(1sec) in a thread pool and the whole result only takes a bit more than 1 sec?!!? what kind of magic lays behind that!? 😱
r
mingkangpan: The key point is they are using
delay
which is suspendable - NOT `sleep`… Using sleep would still block each thread
You still have to use caution when introducing blocking code, rather than suspendable code, into coroutines
m
yeah I realised afterwards too, suspending is not blocking do you think you can also execute 100k io bounded requests parallel? r.g. suspending 100k http requests?
r
yes I recon so
I was at a Vert.x talk the other day where the guys mentioned they are going to be adding Kotlin Coroutine wrappers quite soon
In a similar vein to their Rx wrappers presumably
https://www.techempower.com/benchmarks/#section=data-r8&amp;hw=i7&amp;test=plaintext This is plain Vert.x (in 2013) handling ~650k requests in a second - I wouldn’t expect a huge dent in that number by then offloading to a coroutine context - but you could probably get a hold of the benchmark code to try it out