Is it possible to compute the number of indices and create the typed array up front? That way we won't have to copy the `indices` array to a typed array here.