New Vector data structure in Motoko

Given the benchmarks at: https://mops.one/vector/benchmarks

I’m trying to decide which structure to use when accumulating results to output for returning from an actor endpoint.

It looks like Array may still be the best to use with tabulate if you know the number of items in your result.

If you don’t know the number of results, would you recommend using Vector or Buffer?

I’m also curious if there is a difference in cost for the .toArray cost which will be needed at the end of the calculation to output the data.

1 Like