OCaml Bigarray: slower than builtin arrays?
multidimensional-array, ocaml
Solution
Just based on looking through the implementations, I'd say that bigarrays might be slower if you create large numbers of short-lived arrays. It looks like the memory for them is managed outside the usual OCaml GC, which handles short-lived objects extremely well.
You also might find that accesses to bigarrays aren't inlined, whereas accesses to the built-in arrays would be.
On the other hand, built-in arrays are going to have an extra indirection for two-dimensions.
If the performance really matters, you'll probably have to benchmark your particular application.
Problem
What are the downsides of using `Bigarray` when interfacing with C is not an issue? Are they slower, in particular for small 2D matrices?