k6-docs
k6-docs copied to clipboard
Point out some SharedArrays DoNots
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