Hi Dave & Blair - Actually the statement
var iterator = it(T,N); creates an array storing the result of iterating. While it's good to know that you found this surprising, it's how the language is currently defined. The language spec is pretty clear on this point in section 21.3.2. I think that, going forward, the language ought to have a way to represent capturing an iterator (which you can't really do now) as well as promoting it to an array. I'm not prepared to predict how you'd write each of these in the future. Thanks for your note, -michael On 6/3/16, 8:12 AM, "David G. Wonnacott" <[email protected]> wrote: > >We've been using iterators in a variety of ways, and have come across a >"performance bug" that seems to come up when an iterator is *not* created >in the header of the loop whose iteration space it defines. The memory >requirement is much higher in this case, > perhaps proportional to the total number of iterations? It seems to be >allocating memory (on the free store heap, presumably) for each >iteration, as would happen if the result of the iterator were >heap-allocated rather than on the stack. The memory use grows > quickly for a large iteration space, filling our RAM plus swap on our >machine; some examples just run really really slowly, and others crash. > > >We have attached a fairly minimal Chapel program that demonstrates the >difference. We are using "chpl Version 1.11.0" on Ubuntu 14.04. > > >Thanks, > Dave Wonnacott & Blair Rush, Haverford College > > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e _______________________________________________ Chapel-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-bugs
