k6-docs icon indicating copy to clipboard operation
k6-docs copied to clipboard

Point out some SharedArrays DoNots

Open mstoykov opened this issue 2 months ago • 0 comments

SharedArray is special in that it has special underlying implementation. It is meant to work just as any other array, but that doesn't mean htat some operations are not ... bad.

A good example is using .filter or .map on it as both of those will create a new normal array - which usually will remove any of SharedArrays memory efficency benefits.

Also marshalling it or using to store a single big object are other common cases.

Lately also returning it as part of setup has been popping up and it has the same problem as marshalling ... as it is going to be marshalled by setup

mstoykov avatar Sep 22 '25 11:09 mstoykov