Hi Christoph, On Monday, November 17, 2014 11:34:02 PM Christoph Ortner wrote: > Can I confirm something: is it true that when I do > A[ L[:, Lcol] ] > then L[:, Lcol] creates a new d-dimensional array and copies that data into > that array?
It creates a new 1d array containing just that column. > Can this at all be avoided? (I believe this is the bottlenbeck > in what I do?) It's one of the bottlenecks, yes. Currently if you want to write it this way, there is no way to avoid allocating memory for that column. As of a few days ago, julia 0.4 contains all the ingredients needed to change this, but the soup has not yet been assembled. You could open an issue if you like. > What strikes me as odd here is that *104,000,080 bytes* are being allocated. > If L is an Int16 array, then it should be no more than 100^3 x 3 x 8 = > 6,000,000 ? You are a wise person to pay attention to that detail. You have a type- stability problem---specifically, your darray container needs to declare the concrete type of the objects inside. Sorry to foist you off on the manual, but there's a lot of reading you need to do (and it would be silly to just say it all again): http://docs.julialang.org/en/release-0.3/manual/faq/#how-do-abstract-or-ambiguous-fields-in-types-interact-with-the-compiler and the section below it. (You can also refer to material higher up on that page.) http://docs.julialang.org/en/release-0.3/manual/types/#man-parametric-types http://docs.julialang.org/en/release-0.3/manual/performance-tips/#measure-performance-with-time-and-pay-attention-to-memory-allocation Also: - type names in Julia are conventionally capitalized - there is already a DArray type (see the Parallel Programming section of the manual), so you really should choose a different name. --Tim