3 ms·
With empty suspended coros, we use about 169M for 300,000 of them. So that's about .5K per coroutine. In Haskell, 500,000 threads waiting for an empty mvar us
by jrockway 17y ago
With empty suspended coros, we use about 169M for 300,000 of them. So that's about .5K per coroutine.
In Haskell, 500,000 threads waiting for an empty mvar used about 1.4G of RAM. But if they just spin forever (foo = foo), not waiting for anything, then it uses 129M for 500,000 threads; .2K each.
So really, coroutines are not costly at all. Most of the price you pay you would have to pay anyway. The overhead of the coroutine itself is tiny.
- silentbicycle 17y agoGood to know, thanks for the quick response.
- jrockway 17y agoAnd just for the record, my examples were on a 64 bit machine.