Small fixed size arrays would certainly be great to have in Base. With the recent work on SIMD, certain operations could really end up with huge performance gains.
-viral On Thursday, May 8, 2014 3:17:55 PM UTC+5:30, Tobias Knopp wrote: > > Definately fixed-size arrays should be in base. The question is a little > how this interacts with NTuple, which (if I understand this correctly) also > be at some point "tight" fixed-size vectors. > > Am Donnerstag, 8. Mai 2014 11:03:08 UTC+2 schrieb Carlos Becker: >> >> Thanks, that's great! >> >> Maybe this should make it to upstream julia. >> Fixed-size arrays are essential to get good performance, and compact >> memory usage. >> >> >> ------------------------------------------ >> Carlos >> >> >> On Wed, May 7, 2014 at 5:46 PM, Tobias Knopp <tobias...@googlemail.com>wrote: >> >>> see https://github.com/JuliaLang/julia/issues/5857. I have been using >>> ImmutableArrays.jl which works fine. >>> >>> Am Mittwoch, 7. Mai 2014 17:12:04 UTC+2 schrieb Carlos Becker: >>> >>>> Hello, I am trying to find out the best way to deal with immutables (or >>>> types) that contain fixed-size arrays, such as this: >>>> >>>> # should have variable number of >>>> >>>> # Uint64's >>>> >>>> immutable Descriptor >>>> >>>> a1::Uint64 >>>> >>>> a2::Uint64 >>>> >>>> a3::Uint64 >>>> >>>> a4::Uint64 >>>> >>>> end >>>> >>>> # should work with variable-size Descriptor >>>> >>>> function myDist(x1::Descriptor,x2::Descriptor) :inline >>>> >>>> return count_ones(x1.a1 $ x2.a1) + count_ones(x1.a2 $ x2.a2) + >>>> count_ones(x1.a3 $ x2.a3) + count_ones(x1.a4 $ x2.a4) >>>> >>>> end >>>> >>>> >>>> >>>> In this specific case, Descriptor is 32-bytes wide, but I would like to >>>> make the code generic for different number of elements in the immutable. >>>> If fixed-size arrays were available, this would be very easy, but which >>>> is a neat way of doing this with the current julia v0.3? >>>> >>>> btw, the code above runs amazingly fast, using popcount instructions >>>> when available, almost c-speed ;) >>>> This is good news for Julia indeed. >>>> >>>> Thanks. >>>> >>> >>