I'm learning what it takes to turn an existing mixed Python / C ++ mixed number base into a mixed Scala / C ++ (ideally basically Scala eventually). I expect that the biggest problem will be the many arrays of structures. For example, in C ++ we have types such as
Array<Vector<double,3>>
They can be converted back and forth between Python and C ++ without copying thanks to Numpy.
In the JVM, since unboxed arrays can have only a few types, the only way I can imagine is to create (1) a type in a Scala box for each structure, for example Vector<double,3> and (2) a typed thin wrapper around Array[Double] , which knows what structure it should be and creates / consumes single packets alone as needed.
Are there existing libraries that do such a thing, or implement any alternatives for packed arrays of structures? Does anyone have any experience with what performance symbols will be, and can existing compilers and JVMs optimize fields in at least a non-polymorphic, sealed case?
Please note that packaging and nice input are not optional: without packaging, I will quickly explode the memory, and if all I have is Array [Double] A system like C ++ (unfortunately) wins.
source share