Reference to dense<f32,2> columns

Reference to dense columns

HiI am playing around with arbb and i have a question about dense array slice.It seems to me that the member function of dense :dense col(const usize& index) const;copies the column to a new dense vector.Is it possible to avoid the copy and create a dense array which is an alias of a column ?Thank you very much.

2 帖子 / 0 全新


Almost all ArBB operators and functions return by value not by reference. The reason is to ensure safety of parallelism. Data races such as concurrent accessing to the same object via different aliases is avoided. This also helps the JIT compiler to do more aggressive optimizations.

If this gives you concerns about performance, then please note that ArBB container objects are handles to the actual data. When a container is returned by value it does not necessarily mean the underlying data is copied, it's just the handle that is copied. Also note that operations on the same containers are getting "fused" whenever possible by the optimization. So intermediate or temporary containers used in the source code do not have a big impact on performance in reality.

Hope this helps.