babel-plugin-multidimensional-array
Fast multidimensional typed arrays with a nice syntax.
Typed arrays are awesome, but sometimes you want a multidimensional array. You can do it with arrays of (arrays of...) typed arrays, but accessing or writing data to nested array objects is slow.
One way to fix this is by using a single flattened typed array, and hand calculating the offset where the data is for every access. But that is tedious. This babel plugin takes care of it for you. Just define your local variables or function arguments with dimensions, and accesses will be transformed to compute the correct offset.
Example
Compiles this:
let x23 = 123456;x12 = 42;
into:
let x = 123456;x5 = 42;
Function arguments are also supported, as are non-constant dimensions:
{ x1y = 4;}
compiles to:
{ xy + b * 1 = 4;}
Licence
MIT