Add support for fixed sized arrays
densh opened this issue · 3 comments
They would be embeddable into offheap classes as they are fixed size. The length would be statically known which can improve performance of some of the operations. As length is known there would be no need to store in the header of the allocated data.
From the point of view of API it would probably look something along the lines of:
val a1 = FixedArray(1, 2, 3) // a1: FixedArray[_3, Int]
val a2 = farr.map(_ * 2) // loop can be fully unrolled here
Where _3
is some encoding of type-level integers (probably based on consant types.)
This depends on #39 as we need to implement operations we care about on regular arrays first. Some of them where output size of the array might be smaller than input size (e.g. filter) are going to be quite problematic as one would have to express size changes in the types for it to work. I think I underestimated complexity of the implementation here and we should wait for 0.1 to happen first.
Given little to no interest I'm closing the issue. At the same time we're likely to have fixed-size arrays in Scala Native for interop reasons. scala-native/scala-native#35