Joel C. Salomon wrote: > grauzone wrote: >> downs wrote: >>> Daniel Keep wrote: >>>> Here's an excellent reason to use ranges over opApply: you >>>> can't define zip with opApply. Because opApply uses inversion of >>>> control, you can't use more than one without bringing threads into the >>>> equation. >>> Your point stands, of course, but I just wanted to mention that >>> stackthreads/fibers work too and have far less overhead. >> First, don't they have LOTS of memory overhead, because each fiber needs >> a new/separate stack? > > A fiber-specific stack needn’t be very large. A few KB is often enough > even for long-running threads; if the call stack is only going to be a > few levels deep you might get away with a few hundred bytes each. > > —Joel Salomon
Furthermore, using anonymous mmapped files the memory is only allocated when accessed - the only thing taken is address space. Which, granted, can be limiting. Luckily 64-bit will fix that. :)